nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: update sav with `package` instead of `project`
[nit.git]
/
lib
/
sha1.nit
diff --git
a/lib/sha1.nit
b/lib/sha1.nit
index
baf269a
..
8a5acc9
100644
(file)
--- a/
lib/sha1.nit
+++ b/
lib/sha1.nit
@@
-228,13
+228,13
@@
redef class String
# If you want the hex string version of the digest, use
# sha1_to_s.
#
# If you want the hex string version of the digest, use
# sha1_to_s.
#
- # assert "The quick brown fox jumps over the lazy dog".sha1.encode_base64 == "L9ThxnotKPzthJ7hu3bnORuT6xI="
+ # import base64
+ # assert "The quick brown fox jumps over the lazy dog".sha1.encode_base64 == "L9ThxnotKPzthJ7hu3bnORuT6xI="
fun sha1: String import String.to_cstring, String.length, NativeString.to_s_with_length `{
fun sha1: String import String.to_cstring, String.length, NativeString.to_s_with_length `{
- uint32_t a;
sha1nfo s;
sha1_init(&s);
sha1nfo s;
sha1_init(&s);
- sha1_write(&s, String_to_cstring(recv), String_length(recv));
+ sha1_write(&s, String_to_cstring(self), String_length(self));
uint8_t* digest = sha1_result(&s);
char* digested = malloc(21);
uint8_t* digest = sha1_result(&s);
char* digested = malloc(21);
@@
-251,13
+251,12
@@
redef class String
# Returns a 40 char String containing the Hexadecimal
# Digest in its Char form.
#
# Returns a 40 char String containing the Hexadecimal
# Digest in its Char form.
#
- # assert "The quick brown fox jumps over the lazy dog".sha1_to_s == "2FD4E1C67A2D28FCED849EE1BB76E7391B93EB12"
+ # assert "The quick brown fox jumps over the lazy dog".sha1_to_s == "2FD4E1C67A2D28FCED849EE1BB76E7391B93EB12"
fun sha1_to_s: String import String.to_cstring, String.length, NativeString.to_s_with_length `{
fun sha1_to_s: String import String.to_cstring, String.length, NativeString.to_s_with_length `{
- uint32_t a;
sha1nfo s;
sha1_init(&s);
sha1nfo s;
sha1_init(&s);
- sha1_write(&s, String_to_cstring(recv), String_length(recv));
+ sha1_write(&s, String_to_cstring(self), String_length(self));
uint8_t* digest = sha1_result(&s);
char* ret_str = malloc(41);
uint8_t* digest = sha1_result(&s);
char* ret_str = malloc(41);