lib/utility.js
function createSHAHash(buffer, algorithm) {
    var logger = getLogger('utility.createSHA1Hash');
    var sha1sum = crypto.createHash(algorithm || 'sha1');
    if (require('util').isArray(buffer)) {
        if (logger.isDebugEnabled()) {
            logger.debug('It\'s an Array of buffers');
        }
        for (var i = 0; i < buffer.length; i++) {
            sha1sum.update(buffer[i]);
        }
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug('It\'s only one buffer');
        }
        sha1sum.update(buffer);
    }
    return sha1sum.digest();
}
function createSHAHash(buffer, algorithm) {
    var logger = getLogger('utility.createSHA1Hash');
    var sha1sum = crypto.createHash(algorithm || 'sha1');
    if (require('util').isArray(buffer)) {
        if (logger.isDebugEnabled()) {
            logger.debug('It\'s an Array of buffers');
        }
        for (var i = 0; i < buffer.length; i++) {
            sha1sum.update(buffer[i]);
        }
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug('It\'s only one buffer');
        }
        sha1sum.update(buffer);
    }
    return sha1sum.digest();
}
function createSHAHash ( buffer , algorithm ) { var logger = getLogger ( 'utility.createSHA1Hash' ) ; var sha1sum = crypto . createHash ( algorithm || 'sha1' ) ; if ( require ( 'util' ) . isArray ( buffer ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( 'It\'s an Array of buffers' ) ; } for ( var i = 0 ; i < buffer . length ; i ++ ) { sha1sum . update ( buffer [ i ] ) ; } } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( 'It\'s only one buffer' ) ; } sha1sum . update ( buffer ) ; } return sha1sum . digest ( ) ; }
Create SHA1 hash starting from a buffer or an array of buffers
Create SHA1 hash starting from a buffer or an array of buffers