ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > N.A.N.Y. 2019

This is an entry for NANY 2019 - SCrypt

<< < (3/3)

You really should post at least some relevant code fragments, otherwise noone will believe that you´re doing really a usable encryption. I also posted such an experimental (super-)encryption tool a few years ago and it was necessary to publish the source also.
The same problem came up with a game solving AI robot at a coding contest. Nobody believed that I was able to find the best solution within a few nanoseconds while the best were not able to break the milliseconds barrier and some others needed several seconds. They didn´t believe that this is technically possible until I released the sourcecode.
-Crush (August 22, 2018, 06:25 AM)
--- End quote ---
Okay, here we go

--- Code: Delphi ---type  AllBytes = array of Int64; var  i, NumOfBytes : Integer;  NextKey, CurrentByte : Int64; procedure Crypt(var ManyBytes : AllBytes);begin  for i := 0 to NumOfBytes - 1 do    begin      CurrentByte := ManyBytes[i];//      NextKey := *removed*      asm        MOVQ mm0, NextKey; // <- store NextKey        MOVQ mm1, CurrentByte; // <- store CurrentByte        PXOR mm1, mm0; // <- at this point we have XOR cryption done via MMX        MOVQ  CurrentByte, mm1; // give result back        EMMS;      end;      ManyBytes[i] := CurrentByte;    end;end;That represent main crypto part. Feel free to use or examine. I've slightly commented it.
Only missing Part to get it straight working is my Array for NextKey Values.

Looks like a straight forward xor from byte to byte - no salt, password or any other "security". No complex code and I see no higher protection. Bad to read, but not too hard to crack. The "real" scrypt is incredible much better. There´s a lot of space to improve your method - do this with an additional keyword that you procede the same way.

For the type of how it is used here, it is more than good enough. Intention was to (client side) crypt on the fly, send data via udp or tcp/ip, (server side) decrypt on the fly, done. Imagine a crypted Chat-Session for example. What i wrote in Post #1 should match. I am no expert but have experience and always interested in other ways to reach goal. My goal was to quick de-/crypt data, nothing more nothing less.

For a crypto competion i have talent enough to create something way better, but that was not focus of this project, just speed.

For speed there´s still place for optimization  :D

I hope your "NumOfBytes" is badly named, and is really "NumOfInt64Blocks" :-)

Unless your "//      NextKey := *removed*" fetches a value from a One-Time-Pad with the same length as the data you're encrypting, that you're never re-using the OTP, and that you have a guaranteed non-surveilled channel for getting the OTP to the other side... then this is pretty useless.

I'm sorry if "useless" seems like a harsh word, but it's true nonetheless. If there's any reason to use crypto at all, use proper crypto. A scheme like this is definitely not good enough for "a crypted Chat-Session" - if you're discussing sensitive matters you need a whole lot more (there are perfectly good reasons Signal has a complex protocol), if you're not... well, who cares, send plaintext or use a HTTPS connection. Doesn't matter much if NSA knows when you're gonna hook up with your girlfriend, or what groceries you need to pick up on your way home from work :-)

Also, the code is pretty slow - no loop unrolling, and EMMS'ing for every block? Ouch! :)


[0] Message Index

[*] Previous page

Go to full version