W WhiteWizard Member Licensed User Dec 2, 2020 #1 I'm creating my own encription function, witch ends coding a bunch of bytes in Base64 format, so it can be sent to my NODE JS API REST. The same encription function is build in NODE JS, so I can compare both results. The final Base64 is constructed with the encripted password, an array of n bytes, where n = length of string to encode + the representation of 1 byte encoded in Base64 witch represent the portion of the key that was aplied to this encription (witch I call HINT). The Weir part is that an 8 character pass encripted and encoded in Base64 differs with the NODE JS algorithm in the final 4 chars (the base64 representation of Hint). Hint is a value from 0 to 7. Code: Dim su As StringUtils Dim Base64Hint(1) As Byte Dim selHint As Byte = 0 selHint = Rnd(0,7) Base64Hint(0) = selHint Log("hint:" & selHint & " , HintBase64:" & su.EncodeBase64(Base64Hint)) Results: hint:4 , HintBase64:BA== NODEJS:NA== Allways working in UTF-8 I'be check those values in https://www.base64decode.org/ and the NODEJS values are rigth.
I'm creating my own encription function, witch ends coding a bunch of bytes in Base64 format, so it can be sent to my NODE JS API REST. The same encription function is build in NODE JS, so I can compare both results. The final Base64 is constructed with the encripted password, an array of n bytes, where n = length of string to encode + the representation of 1 byte encoded in Base64 witch represent the portion of the key that was aplied to this encription (witch I call HINT). The Weir part is that an 8 character pass encripted and encoded in Base64 differs with the NODE JS algorithm in the final 4 chars (the base64 representation of Hint). Hint is a value from 0 to 7. Code: Dim su As StringUtils Dim Base64Hint(1) As Byte Dim selHint As Byte = 0 selHint = Rnd(0,7) Base64Hint(0) = selHint Log("hint:" & selHint & " , HintBase64:" & su.EncodeBase64(Base64Hint)) Results: hint:4 , HintBase64:BA== NODEJS:NA== Allways working in UTF-8 I'be check those values in https://www.base64decode.org/ and the NODEJS values are rigth.
W WhiteWizard Member Licensed User Dec 2, 2020 #2 My mistake, surelly is a char "0" ..."7" what is converted to Base64 in NODE JS, it works character based and not byte based as B4X. line 6 should be Code: Base64Hint(0) = asc(selHint)
My mistake, surelly is a char "0" ..."7" what is converted to Base64 in NODE JS, it works character based and not byte based as B4X. line 6 should be Code: Base64Hint(0) = asc(selHint)