�PNG  IHDR��;���IDATx��ܻn�0���K�� �)(�pA��� ���7�LeG{�� �§㻢|��ذaÆ 6lذaÆ 6lذaÆ 6lom��$^�y���ذag�5bÆ 6lذaÆ 6lذa{���� 6lذaÆ �`����}H�Fkm�,�m����Ӫ���ô�ô!� �x�|'ܢ˟;�E:���9�&ᶒ�}�{�v]�n&�6� �h��_��t�ڠ͵-ҫ���Z;��Z$�.�P���k�ž)�!��o���>}l�eQfJ�T��u і���چ��\��X=8��Rن4`Vw�l�>����n�G�^��i�s��"ms�$�u��i��?w�bs[m�6�K4���O���.�4��%����/����b�C%��t ��M�ז� �-l�G6�mrz2���s�%�9��s@���-�k�9�=���)������k�B5����\��+͂�Zsٲ ��Rn��~G���R���C����� �wIcI��n7jJ���hۛNCS|���j0��8y�iHKֶۛ�k�Ɉ+;Sz������L/��F�*\��Ԕ�#"5��m�2��[S��������=�g��n�a�P�e�ғ�L�� lذaÆ 6l�^k��̱aÆ 6lذaÆ 6lذa;���� �_��ذaÆ 6lذaÆ 6lذaÆ ���R���IEND�B` 'use strict'; const baseEncodeTables = { 26: 'abcdefghijklmnopqrstuvwxyz', 32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio 36: '0123456789abcdefghijklmnopqrstuvwxyz', 49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO 52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO 62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_', }; function encodeBufferToBase(buffer, base) { const encodeTable = baseEncodeTables[base]; if (!encodeTable) { throw new Error('Unknown encoding base' + base); } const readLength = buffer.length; const Big = require('big.js'); Big.RM = Big.DP = 0; let b = new Big(0); for (let i = readLength - 1; i >= 0; i--) { b = b.times(256).plus(buffer[i]); } let output = ''; while (b.gt(0)) { output = encodeTable[b.mod(base)] + output; b = b.div(base); } Big.DP = 20; Big.RM = 1; return output; } function getHashDigest(buffer, hashType, digestType, maxLength) { hashType = hashType || 'md5'; maxLength = maxLength || 9999; const hash = require('crypto').createHash(hashType); hash.update(buffer); if ( digestType === 'base26' || digestType === 'base32' || digestType === 'base36' || digestType === 'base49' || digestType === 'base52' || digestType === 'base58' || digestType === 'base62' || digestType === 'base64' ) { return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr( 0, maxLength ); } else { return hash.digest(digestType || 'hex').substr(0, maxLength); } } module.exports = getHashDigest;