lib/messageFormatter.js
function hashSymbol( value ) {
	var i , iMax , hash = 0 , output , offset ;

	value = '' + value ;

	// At least 3 passes
	offset = 3 * 16 / value.length ;

	for ( i = 0 , iMax = value.length ; i < iMax ; i ++ ) {
		hash ^= value.charCodeAt( i ) << ( ( i * offset ) % 16 ) ;
		//hash += value.charCodeAt( i ) ;
		//hash += value.charCodeAt( i ) * ( i + 1 ) ;
	}

	output = symbols[ hash % symbols.length ] ;
	hash = Math.floor( hash / symbols.length ) ;

	output = string.ansi[ fgColors[ hash % fgColors.length ] ] + output ;
	hash = Math.floor( hash / fgColors.length ) ;

	output = string.ansi[ bgColors[ hash % bgColors.length ] ] + output ;
	hash = Math.floor( hash / bgColors.length ) ;

	output += string.ansi.reset ;

	return output ;
}
function hashSymbol( value ) {
	var i , iMax , hash = 0 , output , offset ;

	value = '' + value ;

	// At least 3 passes
	offset = 3 * 16 / value.length ;

	for ( i = 0 , iMax = value.length ; i < iMax ; i ++ ) {
		hash ^= value.charCodeAt( i ) << ( ( i * offset ) % 16 ) ;
		//hash += value.charCodeAt( i ) ;
		//hash += value.charCodeAt( i ) * ( i + 1 ) ;
	}

	output = symbols[ hash % symbols.length ] ;
	hash = Math.floor( hash / symbols.length ) ;

	output = string.ansi[ fgColors[ hash % fgColors.length ] ] + output ;
	hash = Math.floor( hash / fgColors.length ) ;

	output = string.ansi[ bgColors[ hash % bgColors.length ] ] + output ;
	hash = Math.floor( hash / bgColors.length ) ;

	output += string.ansi.reset ;

	return output ;
}
function hashSymbol ( value ) { var i , iMax , hash = 0 , output , offset ; value = '' + value ; // At least 3 passes offset = 3 * 16 / value . length ; for ( i = 0 , iMax = value . length ; i < iMax ; i ++ ) { hash ^= value . charCodeAt ( i ) << ( ( i * offset ) % 16 ) ; //hash += value.charCodeAt( i ) ; //hash += value.charCodeAt( i ) * ( i + 1 ) ; } output = symbols [ hash % symbols . length ] ; hash = Math . floor ( hash / symbols . length ) ; output = string . ansi [ fgColors [ hash % fgColors . length ] ] + output ; hash = Math . floor ( hash / fgColors . length ) ; output = string . ansi [ bgColors [ hash % bgColors . length ] ] + output ; hash = Math . floor ( hash / bgColors . length ) ; output += string . ansi . reset ; return output ; }
Naive CRC-like algorithm
Naive CRC - like algorithm