Hash

object Hash
class Object
trait Matchable
class Any
Hash.type

Value members

Concrete methods

def apply(s: String): Array[Byte]

Calculates the SHA-1 hash of the given String.

Calculates the SHA-1 hash of the given String.

def apply(as: Array[Byte]): Array[Byte]

Calculates the SHA-1 hash of the given Array[Byte].

Calculates the SHA-1 hash of the given Array[Byte].

def apply(file: File): Array[Byte]

Calculates the SHA-1 hash of the given file.

Calculates the SHA-1 hash of the given file.

def apply(url: URL): Array[Byte]

Calculates the SHA-1 hash of the given resource.

Calculates the SHA-1 hash of the given resource.

def apply(stream: InputStream): Array[Byte]

Calculates the SHA-1 hash of the given stream, closing it when finished.

Calculates the SHA-1 hash of the given stream, closing it when finished.

def contentsIfLocal(uri: URI): Array[Byte]

If the URI represents a local file (the scheme is "file"), this method calculates the SHA-1 hash of the contents of that file. Otherwise, this methods calculates the SHA-1 hash of the normalized string representation of the URI.

If the URI represents a local file (the scheme is "file"), this method calculates the SHA-1 hash of the contents of that file. Otherwise, this methods calculates the SHA-1 hash of the normalized string representation of the URI.

def fromHex(hex: String): Array[Byte]

Converts the provided hexadecimal representation hex to an array of bytes. The hexadecimal representation must have an even number of characters in the range 0-9, a-f, or A-F.

Converts the provided hexadecimal representation hex to an array of bytes. The hexadecimal representation must have an even number of characters in the range 0-9, a-f, or A-F.

def halfHashString(s: String): String

Computes the SHA-1 hash of s and truncates the hexadecimal representation of the hash via halve.

Computes the SHA-1 hash of s and truncates the hexadecimal representation of the hash via halve.

def halve(s: String): String

Truncates the last half of s if the string has at least four characters. Otherwise, the original string is returned.

Truncates the last half of s if the string has at least four characters. Otherwise, the original string is returned.

def toHex(bytes: Array[Byte]): String

Converts an array of bytes to a hexadecimal representation String.

Converts an array of bytes to a hexadecimal representation String.

def trimHashString(s: String, i: Int): String

Computes the SHA-1 hash of s and returns the first i characters of the hexadecimal representation of the hash.

Computes the SHA-1 hash of s and returns the first i characters of the hexadecimal representation of the hash.