diff --git a/test/simple/test-crypto.js b/test/simple/test-crypto.js index 36f232d6782..cfbc5428f4f 100644 --- a/test/simple/test-crypto.js +++ b/test/simple/test-crypto.js @@ -446,6 +446,15 @@ a6.write('123'); a6.end(); a6 = a6.read(); +var a7 = crypto.createHash('sha512'); +a7.end(); +a7 = a7.read(); + +var a8 = crypto.createHash('sha512'); +a8.write(''); +a8.end(); +a8 = a8.read(); + assert.equal(a0, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'Test SHA1'); assert.equal(a1, 'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca' + '\u00bd\u008c', 'Test MD5 as binary'); @@ -468,6 +477,8 @@ assert.deepEqual(a4, // stream interface should produce the same result. assert.deepEqual(a5, a3, 'stream interface is consistent'); assert.deepEqual(a6, a3, 'stream interface is consistent'); +assert.notEqual(a7, undefined, 'no data should return data'); +assert.notEqual(a8, undefined, 'empty string should generate data'); // Test multiple updates to same hash var h1 = crypto.createHash('sha1').update('Test123').digest('hex');