private int reverseHash ( String str ) { int hash = 0 ; int len = str . length ( ) ; for ( int i = 0 ; i < _block ; i ++ ) { char c = str . charAt ( len - i - 1 ) ; hash = A * hash + CHAR_HASHES [ c ] ; } return hash ; }
Take rolling hash of last block characters . Start from the end of the string .