3 var crypto = require('crypto');
6 if (typeof Buffer.from === 'function') {
8 if (Array.isArray(bytes)) {
9 bytes = Buffer.from(bytes);
10 } else if (typeof bytes === 'string') {
11 bytes = Buffer.from(bytes, 'utf8');
15 if (Array.isArray(bytes)) {
16 bytes = new Buffer(bytes);
17 } else if (typeof bytes === 'string') {
18 bytes = new Buffer(bytes, 'utf8');
22 return crypto.createHash('md5').update(bytes).digest();