nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: typing: new warning `useless-truism` to catch trainees.
[nit.git]
/
lib
/
md5.nit
diff --git
a/lib/md5.nit
b/lib/md5.nit
index
6495145
..
037c03d
100644
(file)
--- a/
lib/md5.nit
+++ b/
lib/md5.nit
@@
-14,7
+14,7
@@
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
-# Implements the md5 function in C
+# Native MD5 digest implementation as `Text::md5`
module md5
in "C Header" `{
module md5
in "C Header" `{
@@
-489,7
+489,7
@@
in "C Header" `{
}
`}
}
`}
-redef class String
+redef class Text
# MD5 digest of `self`
#
# ~~~
# MD5 digest of `self`
#
# ~~~
@@
-500,15
+500,15
@@
redef class String
fun md5: String do return to_cstring.native_md5.to_s
end
fun md5: String do return to_cstring.native_md5.to_s
end
-redef class NativeString
- private fun native_md5: NativeString `{
+redef class CString
+ private fun native_md5: CString `{
md5_state_t state;
md5_byte_t digest[16]; /* result */
char *hex_output = malloc(33*sizeof(char));
int di;
md5_init(&state);
md5_state_t state;
md5_byte_t digest[16]; /* result */
char *hex_output = malloc(33*sizeof(char));
int di;
md5_init(&state);
- md5_append(&state, (const md5_byte_t *)self, strlen(self));
+ md5_append(&state, (const md5_byte_t *)self, (int)strlen(self));
md5_finish(&state, digest);
for (di = 0; di < 16; ++di)
md5_finish(&state, digest);
for (di = 0; di < 16; ++di)