How to use the RIPEMD160 function from crypto-js

Find comprehensive JavaScript crypto-js.RIPEMD160 code examples handpicked from public code repositorys.

24
25
26
27
28
29
30
31
32
33
function ripemd160(str) {
  return CryptoJS.RIPEMD160(str).toString();
}

function ripemd160Hex(hexStr) {
  return CryptoJS.RIPEMD160(cryptoHexStringParse(hexStr)).toString();
}

module.exports = {
  sha256,
fork icon22
star icon54
watch icon10

+ 3 other calls in file

146
147
148
149
150
151
152
153
154
    SHA3_224: function(data, secret) {
      return CryptoJS.SHA3(secret + data, { outputLength: 224 });
    },

    RIPEMD160: function(data, secret) {
      return CryptoJS.RIPEMD160(secret + data);
    },
  };
})();
fork icon0
star icon6
watch icon3

+ 9 other calls in file

6
7
8
9
10
11
12
13
14
  if (!Buffer.isBuffer(buffer)) buffer = new Buffer(buffer) // FIXME: transitionary

  var step1 = sha256(buffer)

  var step2a = convert.bytesToWordArray(step1)
  var step2b = CryptoJS.RIPEMD160(step2a)

  return new Buffer(convert.wordArrayToBytes(step2b))
}
fork icon0
star icon5
watch icon4

28
29
30
31
32
33
34
35
36
37
    }
    this.hashAlgorithm = SHA3
    break;
case "RIPEMD-160":
case "RIPEMD160":
    this.hashAlgorithm = CryptoJS.RIPEMD160
    break;
default:
    this.hashAlgorithm = CryptoJS.SHA512
    break;
fork icon2
star icon3
watch icon0

74
75
76
77
78
79
80
81
82
83
},
sha3() {
  return CryptoJS.SHA3(this.text).toString();
},
ripemd160() {
  return CryptoJS.RIPEMD160(this.text).toString();
},
hmacmd5() {
  return CryptoJS.HmacMD5(this.text, this.serect).toString();
},
fork icon0
star icon1
watch icon1

+ 17 other calls in file

16
17
18
19
20
21
22
23
24
25
  // return crypto.createHash('ripemd160').update(input).digest()
  if (typeof input !== 'string') {
    input = CryptoJS.lib.WordArray.create(input)
  }
  const hash = Buffer.from(
    CryptoJS.RIPEMD160(input).toString(CryptoJS.enc.Hex),
    'hex'
  )
  return hash
}
fork icon0
star icon0
watch icon1

7
8
9
10
11
12
13
14
15
16
constructor() {
  console.log('DHTUtils::constructor');
}
calcAddress(content) {
  const contentsSha = CryptoJS.SHA3(content).toString(CryptoJS.enc.Hex);
  const contentRipemd = CryptoJS.RIPEMD160(contentsSha).toString(CryptoJS.enc.Hex);
  //console.log('DHTUtils::calcAddress:: contentRipemd=<',contentRipemd,'>');
  const contentBuffer = Buffer.from(contentRipemd,'hex');
  return base32.encode(contentBuffer,bs32Option);
}
fork icon0
star icon0
watch icon2