# All files / src/encryption hashRipemd160.ts

81.82% Statements 9/11
50% Branches 2/4
100% Functions 2/2
81.82% Lines 9/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    241x

    157x
    157x
    157x

    157x
    157x

    157x

    1x
    157x

     import RIPEMD160 from 'ripemd160-min'

    class Ripemd160Digest {
      async digest(data: NodeJS.TypedArray): Promise<Buffer> {
        const instance = new RIPEMD160()
        Eif (Buffer.isBuffer(data)) {
          instance.update(data)
        } else {
          instance.update(Buffer.from(data.buffer))
        }
        const hash = instance.digest()
        Iif (Array.isArray(hash)) {
          return Promise.resolve(Buffer.from(hash))
        } else {
          return Promise.resolve(Buffer.from(hash.buffer))
        }
      }
    }

    export function createHashRipemd160() {
      return new Ripemd160Digest()
    }