Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatibility issue to javascript libsodium wrapper #6

Open
glaidsen-ds opened this issue May 14, 2021 · 0 comments
Open

compatibility issue to javascript libsodium wrapper #6

glaidsen-ds opened this issue May 14, 2021 · 0 comments

Comments

@glaidsen-ds
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant