additional entry point in Hash

This commit is contained in:
Mark Harrah 2011-02-02 19:25:56 -05:00
parent 6108808aeb
commit 9858c9b91d
1 changed files with 3 additions and 1 deletions

View File

@ -33,7 +33,9 @@ object Hash
array
}
/** Calculates the SHA-1 hash of the given String.*/
def apply(s: String): Array[Byte] = apply(new ByteArrayInputStream(s.getBytes("UTF-8")))
def apply(s: String): Array[Byte] = apply(s.getBytes("UTF-8"))
/** Calculates the SHA-1 hash of the given Array[Byte].*/
def apply(as: Array[Byte]): Array[Byte] = apply(new ByteArrayInputStream(as))
/** Calculates the SHA-1 hash of the given file.*/
def apply(file: File): Array[Byte] = Using.fileInputStream(file)(apply)
/** Calculates the SHA-1 hash of the given stream, closing it when finished.*/