what sha1() will do to russian or any other non english letters? Will sha1() always return english letters?
+1
A:
sha1() has nothing to do with russian or any other non english letters (or any other letters - thanks to enlightening comment from Greg Hewgill)
this PHP function returns returns a string, consists of only digits and latin letters, only first 5 of them
Col. Shrapnel
2010-05-07 09:44:39
It doesn't have anything to do with *english* letters, either. It sounds like you're thinking of the hexadecimal representation of the 160-bit result.
Greg Hewgill
2010-05-07 09:46:17
OMG thinking? what is it?
Col. Shrapnel
2010-05-07 09:52:19
The output of the SHA-1 algorithm is a 160 bit number. Normally, this is converted to a hexadecimal representation for easier reading, such as `7a788f56fa49ae0ba5ebde780efe4d6a89b5db47`.
Greg Hewgill
2010-05-07 09:54:41
sha1() is looks like function name, not algorithm,
Col. Shrapnel
2010-05-07 09:56:37
Right, I see the documentation for the PHP function [`sha1()`](http://php.net/sha1) has a *raw_output* parameter that lets you choose whether you want the hexadecimal representation or not.
Greg Hewgill
2010-05-07 10:00:01
+9
A:
SHA-1 doesn't care about character encoding. It only considers a stream of bytes. The output will always be a 160 bit number.
Anonymouse
2010-05-07 09:45:24
What's worth adding is that usually you convert somehow the input string (characters) to stream of bytes and then apply the SHA-1 algorithm. Depending on the encoding used in the first step, the overall result might be (and practically will be) different.
Grzegorz Oledzki
2010-05-07 09:49:33
+4
A:
sha1 works on bytes, not letters, and it produces a 160-bit binary number. That number is usually represented in hexadecimal notation, so, yes, it will always return english letters ("a" to "f", to be precise).
Marcelo Cantos
2010-05-07 09:46:26