Hi all,
I'm trying to use the NsisCrypt plug-in, because i need to convert a variable into SHA1, which goes into a mysql database.
I know what the password is and how it looks with SHA1:
variable = traytray
converted = a8f3dd5acc59b8029fb68402159e222d604e938a
but when in script, i use:
NsisCrypt::Hash "traytray" "sha1"
Pop $1
MessageBox MB_OK $1
it comes out with:
bgCF8ywhjC98c10dkHJLM0McYBg=
so am I using this wrongly?
or is there something else that will convert ascii to mysql "SHA1"....
NsisCrypt plug-in not working or ?
7 posts
Did you read the wiki page? It says the return value is base64 encoded.
ok, i get the logic now. thanks so much for clarifying that!
but i'm still wanting it to come back as ascii, so I can put it into a mysql sql statement.
do i need to then convert from base64 to ascii with ANOTHER plugin?
but i'm still wanting it to come back as ascii, so I can put it into a mysql sql statement.
do i need to then convert from base64 to ascii with ANOTHER plugin?
It has a base64 decode function...
Hi Anders,
thanks for your time,
but in my noob experience with nsis,
it only returns an "n"
but i could be doing the code wrong.
NsisCrypt::Hash "traytray" "sha1"
Pop $1
MessageBox MB_OK $1
NsisCrypt::Base64Decode $1
Pop $1
MessageBox MB_OK $1
thanks for your time,
but in my noob experience with nsis,
it only returns an "n"
but i could be doing the code wrong.
NsisCrypt::Hash "traytray" "sha1"
Pop $1
MessageBox MB_OK $1
NsisCrypt::Base64Decode $1
Pop $1
MessageBox MB_OK $1
The Hash function appears to use $1 as well as the two parameters passed on the calling line. [ From the Wiki page: ] " If you set NSIS user variable $1 to phrase 'ascii', the[n] the string is hashed as an ASCII string, otherwise, the string is behaved like a unicode one."
Your example doesn't set $1 to "ascii", so the string is processed as Unicode, and Base64Decode will give back Unicode characters. The MessageBox probably sees the first character as just one character and an end of string.
Your example doesn't set $1 to "ascii", so the string is processed as Unicode, and Base64Decode will give back Unicode characters. The MessageBox probably sees the first character as just one character and an end of string.
Crypto::HashData
technobuddha, you can use Crypto Plugin, which let you get exact hex-encoded string:
Crypto plugin
technobuddha, you can use Crypto Plugin, which let you get exact hex-encoded string:
More info:Crypto::HashData "SHA1" "String to be hashed"
Pop $0
Crypto plugin