libsodium-delphi
libsodium-delphi copied to clipboard
compatibility issue to javascript libsodium wrapper
I made a test for crypto_secretbox_easy. I generate the nonce and key then save it to database before converting it to base64 using the codes: field1 := base64.EncodeBytesToString(nonce); field1 := base64.EncodeBytesToString(key); then i try it to load in a front end decoding it back to byte array equivalent uint8Array and passed then to crypto_secretbox_easy of the javascript libsodium wrapper like varOfResult = crypto_secretbox_easy("secret message",nonce,key) and check the result by using console.log(varOfResult) then i also use same secret, message and key but they had different result so i'll make a simple routine to display the byte array in delphi: function ByteArrayToDebugStr(input: TBytes): AnsiString; var i: integer; begin result := ''; for i := low(input) to high(input) do begin if result = '' then result := IntToStr(input[i]) else result := result + ', ' + IntToStr(input[i]) end; end; i'll compare all the parameter and is equal in web i'll use console.log to see the value of uint8Array and in delphi using the routine above and is all equal but the result is different.