mirror of https://github.com/sbt/sbt.git
convenience for hashing String to a String
This commit is contained in:
parent
353be43978
commit
5d11b62876
|
|
@ -33,6 +33,7 @@ object Hash
|
||||||
array
|
array
|
||||||
}
|
}
|
||||||
def halve(s: String): String = if(s.length > 3) s.substring(0, s.length / 2) else s
|
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.*/
|
/** Calculates the SHA-1 hash of the given String.*/
|
||||||
def apply(s: String): Array[Byte] = apply(s.getBytes("UTF-8"))
|
def apply(s: String): Array[Byte] = apply(s.getBytes("UTF-8"))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue