How to use the crypto-js/md5 function in crypto-js

To help you get started, we’ve selected a few crypto-js 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 onsip / SIP.js / src / core / messages / digest-authentication.ts View on Github external
if (this.qop === "auth") {
      // HA2 = MD5(A2) = MD5(method:digestURI)
      ha2 = MD5(this.method + ":" + this.uri);
      // response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
      this.response = MD5(ha1 + ":" + this.nonce + ":" + this.ncHex + ":" + this.cnonce + ":auth:" + ha2);

    } else if (this.qop === "auth-int") {
      // HA2 = MD5(A2) = MD5(method:digestURI:MD5(entityBody))
      ha2 = MD5(this.method + ":" + this.uri + ":" + MD5(body ? body : ""));
      // response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
      this.response = MD5(ha1 + ":" + this.nonce + ":" + this.ncHex + ":" + this.cnonce + ":auth-int:" + ha2);

    } else if (this.qop === undefined) {
      // HA2 = MD5(A2) = MD5(method:digestURI)
      ha2 = MD5(this.method + ":" + this.uri);
      // response = MD5(HA1:nonce:HA2)
      this.response = MD5(ha1 + ":" + this.nonce + ":" + ha2);
    }
  }
}
github onsip / SIP.js / src / core / messages / digest-authentication.ts View on Github external
let ha2;

    // HA1 = MD5(A1) = MD5(username:realm:password)
    const ha1 = MD5(this.username + ":" + this.realm + ":" + this.password);

    if (this.qop === "auth") {
      // HA2 = MD5(A2) = MD5(method:digestURI)
      ha2 = MD5(this.method + ":" + this.uri);
      // response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
      this.response = MD5(ha1 + ":" + this.nonce + ":" + this.ncHex + ":" + this.cnonce + ":auth:" + ha2);

    } else if (this.qop === "auth-int") {
      // HA2 = MD5(A2) = MD5(method:digestURI:MD5(entityBody))
      ha2 = MD5(this.method + ":" + this.uri + ":" + MD5(body ? body : ""));
      // response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
      this.response = MD5(ha1 + ":" + this.nonce + ":" + this.ncHex + ":" + this.cnonce + ":auth-int:" + ha2);

    } else if (this.qop === undefined) {
      // HA2 = MD5(A2) = MD5(method:digestURI)
      ha2 = MD5(this.method + ":" + this.uri);
      // response = MD5(HA1:nonce:HA2)
      this.response = MD5(ha1 + ":" + this.nonce + ":" + ha2);
    }
  }
}
github Sage / carbon / src / components / portrait / portrait-gravatar.spec.js View on Github external
it('returns the correct Gravatar URL', () => {
      const email = 'example@example.com';
      const rendered = TestRenderer.create(
        
      );
      const src = rendered.toTree().instance.gravatarSrc();
      const base = 'https://www.gravatar.com/avatar/';
      const hash = MD5(email);
      const dimensions = 56;
      expect(src).toEqual(`${base}${hash}?s=${dimensions}&d=blank`);
    });
  });
github undefinedZNN / react-koa-mobx-server-side-render / src / containers / Md5 / Md5.jsx View on Github external
plaintextChange = (event) => {
    let state = {...this.state}
    state.plaintext = event.target.value
    state.ciphertext = MD5(state.plaintext).toString()
    state.ciphertextCapital = state.ciphertext.toUpperCase()
    state.ciphertext16 = state.ciphertext.substr(8, 16)
    state.ciphertextCapital16 = state.ciphertextCapital.substr(8, 16)
    this.setState(state)
  }
github jrmi / byemail / byemail / client / src / components / MailboxList.vue View on Github external
gravatarUrl(mailbox) {
      let email = mailbox.address
      let hash = md5(email)
      return 'https://www.gravatar.com/avatar/' + hash + '?d=identicon'
    }
  },
github globeandmail / chart-tool / meteor / imports / api / Charts / methods.js View on Github external
'charts.update.data'(chartId, data) {
    return Charts.update(chartId, {
      $set: {
        data: data,
        md5: MD5(data).toString(),
        lastEdited: new Date()
      }
    });
  },
  'charts.update.dateformat'(chartId, format) {
github ixrock / XTranslate / src / store.ts View on Github external
protected getHash() {
    return MD5(JSON.stringify(this.data)).toString();
  }
github Sage / carbon / src / components / portrait / portrait-gravatar.component.js View on Github external
gravatarSrc() {
    const { theme, gravatarEmail, size } = this.props;
    const { dimensions } = getSizeParams(theme, size);
    const base = 'https://www.gravatar.com/avatar/';
    const hash = MD5(gravatarEmail.toLowerCase());

    return `${base}${hash}?s=${dimensions}&d=blank`;
  }
github OpenNMS / opennms-helm / src / panels / alarm-table / alarm_details.js View on Github external
fingerPrint(situation) {
    return btoa(md5(situation.relatedAlarms));
  }
github btnguyen2k / exter / fe-gui / src / containers / TheHeaderDropdownAccnt.vue View on Github external
String.prototype.md5 = function () {
      return MD5(this)
    }
    let session = utils.loadLoginSession()