Jump to content

DanielIvanCorti

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by DanielIvanCorti

  1. Umh, I'm so noob at this and I don't know assembly.. where to start? Some advice? Thank you
  2. Hi all, I need to operate on a random (long) string of bits, contained in a binary file, produced by an hardware random number generator. I have to do a "whitening" with the very simple Von Neumann algorithm: take the first two bits if they are equal, discard them if they are 1 and 0, output 1 if they are 0 and 1, output 0 take next two bits This process eliminates bias from the string, making it ideal for cryptography purposes. I succeded at this but in a very poor way, reading binary data (displayed as hex), translating it to an INT number and then manually to 1's an 0's AND BACK. It's extremely slow. Do you know any more elegant way to do this? Ideal would be "to talk" in 1 and 0 from the start.. Thank you in advance, Daniel
  3. Ok, thank you very much for your help. One last question.. is it correct to do XOR like am I doing? BitXOR is really doing the XOR between bits or it is operating on the RAPPRESENTATION of that bits (like if it was a string)?
  4. Hi M23, thank you for your reply. Umh.. I am a bit confused now.. I am taking a string into an array as binary and doing BitXOR operations (to decrypt a text), it works fine. But as you can see I cannot have back the plaintext string from the array.. Func _Crypt gives its output as HEX to simplify the handling of the crypted message. #include <Array.au3> #include <String.au3> $string = "ABCD" $key="GGHJ" $Crypted = _Crypt(StringSplit($string, ""), StringSplit($key, "")) $Decrypted = _Decrypt(StringSplit($Crypted, ":"), StringSplit($key, "")) MsgBox(0, "", $Crypted) MsgBox(0, "", $Decrypted) Func _Crypt($array, $key)    For $a = 1 To $array[0]       $array[$a] = Hex(BitXOR(StringToBinary($array[$a]), StringToBinary($key[$a])),2)    Next Return _ArrayToString($array, ":", 1) EndFunc Func _Decrypt($array, $key)     _ArrayDisplay($array)    MsgBox(0, "", _ArrayToString($array, "", 1))    For $a = 1 To $array[0]       $array[$a] = BinaryToString(BitXOR(Dec($array[$a]), StringToBinary($key[$a])))    Next Return _ArrayToString($array, "", 1) EndFunc
  5. Hi all, I am facing a problem with _ArrayToString: when it's used on an array filled usign BinaryToString, it only puts the first element in the string generated. I have been trying for an hour different solutions without success.. #include <String.au3> #include <Array.au3> global $array[4] $array[0] = BinaryToString(99) $array[1] = BinaryToString(89) _ArrayDisplay($array) MsgBox(0, "", _ArrayToString($array)) Am I wrong or is there a bug? Thank you very much, Daniel
×
×
  • Create New...