Removed all @author tags for Jonas Bonér since it has lost its meaning.
Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
parent
15c0462db3
commit
4d649c3903
48 changed files with 10 additions and 198 deletions
|
|
@ -7,9 +7,6 @@ exec scala "$0" "$@"
|
|||
*/
|
||||
import java.security.{MessageDigest, SecureRandom}
|
||||
|
||||
/**
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
object Crypt {
|
||||
val hex = "0123456789ABCDEF"
|
||||
val lineSeparator = System.getProperty("line.separator")
|
||||
|
|
@ -19,8 +16,8 @@ object Crypt {
|
|||
def md5(text: String): String = md5(unifyLineSeparator(text).getBytes("ASCII"))
|
||||
|
||||
def md5(bytes: Array[Byte]): String = digest(bytes, MessageDigest.getInstance("MD5"))
|
||||
|
||||
def sha1(text: String): String = sha1(unifyLineSeparator(text).getBytes("ASCII"))
|
||||
|
||||
def sha1(text: String): String = sha1(unifyLineSeparator(text).getBytes("ASCII"))
|
||||
|
||||
def sha1(bytes: Array[Byte]): String = digest(bytes, MessageDigest.getInstance("SHA1"))
|
||||
|
||||
|
|
@ -33,8 +30,8 @@ object Crypt {
|
|||
def digest(bytes: Array[Byte], md: MessageDigest): String = {
|
||||
md.update(bytes)
|
||||
hexify(md.digest)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def hexify(bytes: Array[Byte]): String = {
|
||||
val builder = new StringBuilder
|
||||
bytes.foreach { byte => builder.append(hex.charAt((byte & 0xF) >> 4)).append(hex.charAt(byte & 0xF)) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue