convenience for hashing String to a String

This commit is contained in:
Mark Harrah 2011-07-06 07:30:47 -04:00
parent 353be43978
commit 5d11b62876
1 changed files with 1 additions and 0 deletions

View File

@ -33,6 +33,7 @@ object Hash
array
}
def halve(s: String): String = if(s.length > 3) s.substring(0, s.length / 2) else s
def halfHashString(s: String): String = halve(toHex(apply(s)))
/** Calculates the SHA-1 hash of the given String.*/
def apply(s: String): Array[Byte] = apply(s.getBytes("UTF-8"))