Méthode | Description | |
---|---|---|
ComputeHash ( this stream, ChecksumAlgorithm hashType = ChecksumAlgorithm.SHA256, long maxBodySize = null ) : byte[] |
Computes the hash of a given InputStream. This is a wrapper over the HashAlgorithm crypto functions.
|
|
ComputeKeyedHash ( this data, string key, |
Computes the HMAC hash of a given byte[]. This is a wrapper over the Mac crypto functions.
|
|
GetEpochSeconds ( this current ) : long |
determine the number of seconds since unix epoch
|
|
ReadExactly ( this stream, long maxCount ) : byte[] |
Reads a stream up to @maxCount number of bytes. Less bytes will be returned if the end of the file is reached.
|
|
ToBase64 ( this data ) : string |
Base64-encode a byte array.
|
|
ToByteArray ( this data ) : byte[] |
Retrieve the byte array for a string in UTF8 encoding
|
|
ToHex ( this data ) : string |
Hex encoding wrapper for a byte array. The output will be 2 character padded string in lower case.
|
|
ToISO8601 ( this timestamp ) : string |
format a date and time into ISO8601 style of "yyyyMMdd'T'HH:mm:ss+0000"
|
|
URLEncode ( this data ) : string |
a utility method to uri encode a text string
|
public static ComputeHash ( this stream, ChecksumAlgorithm hashType = ChecksumAlgorithm.SHA256, long maxBodySize = null ) : byte[] | ||
stream | this | the source stream. Use a MemoryStream if uncertain. |
hashType | ChecksumAlgorithm | the Algorithm to use to compute the hash |
maxBodySize | long | |
Résultat | byte[] |
public static ComputeKeyedHash ( this data, string key, |
||
data | this | byte[] of content to hash |
key | string | secret key to salt the hash. This is assumed to be UTF-8 encoded |
hashType | determines which alogirthm to use. The recommendation is to use HMAC-SHA256 | |
Résultat | byte[] |
public static GetEpochSeconds ( this current ) : long | ||
current | this | the date and time to convert |
Résultat | long |
public static ReadExactly ( this stream, long maxCount ) : byte[] | ||
stream | this | the stream to read |
maxCount | long | the maximum number of bytes to read |
Résultat | byte[] |
public static ToBase64 ( this data ) : string | ||
data | this | byte array to encode. |
Résultat | string |
public static ToByteArray ( this data ) : byte[] | ||
data | this | the data string |
Résultat | byte[] |
public static ToHex ( this data ) : string | ||
data | this | a byte array to encode. The assumption is that the string to encode /// is small enough to be held in memory without streaming the encoding |
Résultat | string |
public static ToISO8601 ( this timestamp ) : string | ||
timestamp | this | the date and time to convert |
Résultat | string |
public static URLEncode ( this data ) : string | ||
data | this | the string |
Résultat | string |