How to use the jsbn/lib/sha1.HMAC.fromArrays function in jsbn

To help you get started, we’ve selected a few jsbn 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 wowserhq / wowser / src / lib / crypto / crypt.js View on Github external
set key(key) {
    console.info('initializing crypt');

    // Fresh RC4's
    this._encrypt = new RC4();
    this._decrypt = new RC4();

    // Calculate the encryption hash (through the server decryption key)
    const enckey = ArrayUtil.fromHex('C2B3723CC6AED9B5343C53EE2F4367CE');
    const enchash = HMAC.fromArrays(enckey, key);

    // Calculate the decryption hash (through the client decryption key)
    const deckey = ArrayUtil.fromHex('CC98AE04E897EACA12DDC09342915357');
    const dechash = HMAC.fromArrays(deckey, key);

    // Seed RC4's with the computed hashes
    this._encrypt.init(enchash);
    this._decrypt.init(dechash);

    // Ensure the buffer is synchronized
    for (let i = 0; i < 1024; ++i) {
      this._encrypt.next();
      this._decrypt.next();
    }
  }
github wowserhq / wowser / src / lib / crypto / crypt.js View on Github external
set key(key) {
    console.info('initializing crypt');

    // Fresh RC4's
    this._encrypt = new RC4();
    this._decrypt = new RC4();

    // Calculate the encryption hash (through the server decryption key)
    const enckey = ArrayUtil.fromHex('C2B3723CC6AED9B5343C53EE2F4367CE');
    const enchash = HMAC.fromArrays(enckey, key);

    // Calculate the decryption hash (through the client decryption key)
    const deckey = ArrayUtil.fromHex('CC98AE04E897EACA12DDC09342915357');
    const dechash = HMAC.fromArrays(deckey, key);

    // Seed RC4's with the computed hashes
    this._encrypt.init(enchash);
    this._decrypt.init(dechash);

    // Ensure the buffer is synchronized
    for (let i = 0; i < 1024; ++i) {
      this._encrypt.next();
      this._decrypt.next();
    }
  }

jsbn

The jsbn library is a fast, portable implementation of large-number math in pure JavaScript, enabling public-key crypto and other applications on desktop and mobile browsers.

MIT
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis