Sha256: 22ee4581a0906b2214f948aa7f57811b3c6ef08e9c80b1b8fdaab5a5d0d22160

Contents?: true

Size: 835 Bytes

Versions: 8

Compression:

Stored size: 835 Bytes

Contents

var test = require("tape")

var crypto = require('crypto')
var cryptoB = require('../')
var assert = require('assert')

function assertSame (fn) {
  test(fn.name, function (t) {
    fn(crypto, function (err, expected) {
      fn(cryptoB, function (err, actual) {
        t.equal(actual, expected)
        t.end()
      })
    })
  })
}

assertSame(function sha1 (crypto, cb) {
  cb(null, crypto.createHash('sha1').update('hello', 'utf-8').digest('hex'))
})

assertSame(function md5(crypto, cb) {
  cb(null, crypto.createHash('md5').update('hello', 'utf-8').digest('hex'))
})

assert.equal(cryptoB.randomBytes(10).length, 10)
test('randomBytes', function (t) {
  cryptoB.randomBytes(10, function(ex, bytes) {
    assert.ifError(ex)
    bytes.forEach(function(bite) {
      assert.equal(typeof bite, 'number')
    })
    t.end()
  })
})

Version data entries

8 entries across 6 versions & 3 rubygems

Version Path
snowball-0.1.22 node_modules/browserify/node_modules/crypto-browserify/test/simple.js
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js
sprockets-browserify-0.1.2 node_modules/browserify/node_modules/crypto-browserify/test/simple.js
sprockets-browserify-0.1.2 node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js
sprockets-browserify-0.1.0 node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js
sprockets-browserify-0.1.0 node_modules/browserify/node_modules/crypto-browserify/test/simple.js