mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-03-02 04:32:55 +00:00
- version bump to 2.2 - creation time options support https://github.com/pvorb/node-md5/blob/master/md5.js#L150 - minor changes to rebrush package definition. Thanks!
14 lines
528 B
TypeScript
14 lines
528 B
TypeScript
import md5 = require('md5');
|
|
|
|
const message = 'message';
|
|
console.log(md5(message)); // should print 78e731027d8fd50ed642340b7c9a63b3
|
|
|
|
const array = new Array<number>(message.length);
|
|
for (let i = 0; i < message.length; ++i) array[i] = message.charCodeAt(i);
|
|
const buffer = new Buffer(array);
|
|
console.log(md5(buffer)); // Should be same result as above.
|
|
|
|
const hash1 = md5('abc', { asString: true });
|
|
const hash2 = md5(hash1 + 'a', { asString: true, encoding: 'binary' });
|
|
const hash3 = md5(hash1 + 'a', { encoding: 'binary' });
|