How to use the md5.js function in md5

To help you get started, we’ve selected a few md5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fossasia / susper.com / node_modules / evp_bytestokey / index.js View on Github external
function EVP_BytesToKey (password, salt, keyLen, ivLen) {
  if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
  if (salt) {
    if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
    if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
  }

  var key = Buffer.alloc(keyLen)
  var iv = Buffer.alloc(ivLen)
  var tmp = Buffer.alloc(0)

  while (keyLen > 0 || ivLen > 0) {
    var hash = new MD5()
    hash.update(tmp)
    hash.update(password)
    if (salt) hash.update(salt)
    tmp = hash.digest()

    var used = 0

    if (keyLen > 0) {
      var keyStart = key.length - keyLen
      used = Math.min(keyLen, tmp.length)
      tmp.copy(key, keyStart, 0, used)
      keyLen -= used
    }

    if (used < tmp.length && ivLen > 0) {
      var ivStart = iv.length - ivLen
github sx1989827 / DOClever / node_modules / evp_bytestokey / index.js View on Github external
function EVP_BytesToKey (password, salt, keyBits, ivLen) {
  if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
  if (salt) {
    if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
    if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
  }

  var keyLen = keyBits / 8
  var key = Buffer.alloc(keyLen)
  var iv = Buffer.alloc(ivLen || 0)
  var tmp = Buffer.alloc(0)

  while (keyLen > 0 || ivLen > 0) {
    var hash = new MD5()
    hash.update(tmp)
    hash.update(password)
    if (salt) hash.update(salt)
    tmp = hash.digest()

    var used = 0

    if (keyLen > 0) {
      var keyStart = key.length - keyLen
      used = Math.min(keyLen, tmp.length)
      tmp.copy(key, keyStart, 0, used)
      keyLen -= used
    }

    if (used < tmp.length && ivLen > 0) {
      var ivStart = iv.length - ivLen
github win-winFE / dms / app / assets / utils / utils.js View on Github external
export const md5 = (str, salt='winwinfe') => new MD5().update(str + salt).digest('hex');
github intershop / intershop-pwa / reports / tslint-gitlab.js View on Github external
.map(error => ({
      description: error.ruleName + ': ' + error.failure,
      fingerprint: new MD5().update(JSON.stringify(error)).digest('hex'),
      location: {
        path: error.name.replace(process.cwd() + '/', ''),
        lines: {
          begin: error.startPosition.line + 1,
        },
      },
    }));
github AxisCommunications / media-stream-library-js / lib / components / auth / digest.ts View on Github external
constructor(params: ChallengeParams, username: string, password: string) {
    const realm = params.get('realm')
    if (realm === undefined) {
      throw new Error('no realm in digest challenge')
    }
    this.realm = realm
    this.ha1Base = new MD5()
      .update(`${username}:${realm}:${password}`)
      .digest('hex')

    const nonce = params.get('nonce')
    if (nonce === undefined) {
      throw new Error('no nonce in digest challenge')
    }
    this.nonce = nonce

    this.opaque = params.get('opaque')

    const algorithm = params.get('algorithm')
    if (algorithm !== undefined) {
      if (algorithm === 'md5') {
        this.algorithm = 'md5'
      } else if (algorithm === 'md5-sess') {
github fossasia / susper.com / node_modules / create-hash / md5.js View on Github external
module.exports = function (buffer) {
  return new MD5().update(buffer).digest()
}
github inaturalist / inaturalist / app / webpack / shared / components / flash_messages.jsx View on Github external
config.currentUser.blockedUserHashes, h =>
            new MD5( ).update( item.user.id.toString( ) ).digest( "hex" ) === h
        )
github sx1989827 / DOClever / node_modules / create-hash / browser.js View on Github external
module.exports = function createHash (alg) {
  alg = alg.toLowerCase()
  if (alg === 'md5') return new MD5()
  if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()

  return new Hash(sha(alg))
}
github sx1989827 / DOClever / node_modules / create-hash / md5.js View on Github external
module.exports = function (buffer) {
  return new MD5().update(buffer).digest()
}

md5

js function for hashing messages with MD5

BSD-3-Clause
Latest version published 4 years ago

Package Health Score

77 / 100
Full package analysis