IGLib
1.5
The IGLib base library for development of numerical, technical and business applications.
|
Basic Cryptographic utilities. More...
Classes | |
class | ConstCrypto |
Contains constants for cryptographic operations from shell functions. More... | |
Static Public Member Functions | |
static int | GetHashLengthBytes (HashType hashType) |
Returns length of the hash value, in bytes, for the specified hash algorithm. More... | |
static int | GetHashLengthHex (HashType hashType) |
Returns length of the HEXADECIMAL hash string for the specified hash algorithm. More... | |
static HashAlgorithm | CreateHashAlgorithm (HashType hashType) |
Returns the appropriate hash algorithm according to the specified hash type, or null if the type is not recognized or the method is not implemented for that type. More... | |
static HashType | GetHashType (string typeString) |
static string | GetHashType (HashType hashType) |
Returns standard string representation of the specified hash type. More... | |
static string | HashTypeToString (HashType hashType) |
Returns standard string representation of the specified hash type. More... | |
static void | ParseHashFile (string filePath, ref List< string[]> hashList) |
Parses the file containing hash values of one or more files, and adds the parsed pairs {hash, filePath} to the specified list. More... | |
static void | ParseHashFileString (string str, ref List< string[]> hashList) |
Parses the string containing hash values of one or more files, and adds the parsed pairs {hash, filePath} to the specified list. More... | |
static string | GetStringHash (string stringToHash, HashType hashType) |
Computes and returns the hash string of the specified kind of the specified string. More... | |
static string | GetStringHashMd5 (string stringToHash) |
Computes and returns the SHA1 hash string of the specified string. More... | |
static string | GetStringHashSha1 (string stringToHash) |
Computes and returns the SHA1 hash string of the specified string. More... | |
static string | GetStringHashSha256 (string stringToHash) |
Computes and returns the SHA256 hash string of the specified string. More... | |
static string | GetStringHashSha512 (string stringToHash) |
Computes and returns the SHA512 hash string of the specified string. More... | |
static bool | CheckStringHash (string stringToCheck, string hashValue, HashType hashType) |
Chechs the specified type of hash value of a string. More... | |
static HashType | CheckStringHashSupportedTypes (string stringToCheck, string hashValue) |
Chechs all supported types of hash value of a string. More... | |
static bool | CheckStringHashMd5 (string stringToCheck, string hashValue) |
Checks whether the specified MD5 hash value matches the actual hash value of the specified string. More... | |
static bool | CheckStringHashSha1 (string stringToCheck, string hashValue) |
Checks whether the specified SHA-1 hash value matches the actual hash value of the specified string. More... | |
static bool | CheckStringHashSha256 (string stringToCheck, string hashValue) |
Checks whether the specified SHA-256 hash value matches the actual hash value of the specified string. More... | |
static bool | CheckStringHashSha512 (string stringToCheck, string hashValue) |
Checks whether the specified SHA-512 hash value matches the actual hash value of the specified string. More... | |
static string | GetFileHash (string filePath, HashType hashType) |
Computes and returns the hash string of specified type of the specified stream. More... | |
static string | GetFileHashMd5 (string filePath) |
Computes and returns the MD5 hash string of the specified stream. More... | |
static string | GetFileHashSha1 (string filePath) |
Computes and returns the SHA1 hash string of the specified stream. More... | |
static string | GetFileHashSha256 (string filePath) |
Computes and returns the SHA256 hash string of the specified stream. More... | |
static string | GetFileHashSha512 (string filePath) |
Computes and returns the SHA512 hash string of the specified stream. More... | |
static string | GetHash (Stream stream, HashType hashType) |
Computes and returns the hash string of specified type of the specified stream. More... | |
static string | GetHashMd5 (Stream stream) |
Computes and returns the MD5 hash string of the specified stream. More... | |
static string | GetHashSha1 (Stream stream) |
Computes and returns the SHA1 hash string of the specified stream. More... | |
static string | GetHashSha256 (Stream stream) |
Computes and returns the SHA256 hash string of the specified stream. More... | |
static string | GetHashSha512 (Stream stream) |
Computes and returns the SHA512 hash string of the specified stream. More... | |
static bool | CheckFileHash (string filePath, string hashValue, HashType hashType) |
Chechs the specified type of hash value of a file. More... | |
static HashType | CheckFileHashSupportedTypes (string filePath, string hashValue) |
Chechs all supported types of hash value of a file. More... | |
static bool | CheckFileHashMd5 (string filePath, string hashValue) |
Checks whether the specified MD5 hash value matches the actual hash value of the specified file. More... | |
static bool | CheckFileHashSha1 (string filePath, string hashValue) |
Checks whether the specified SHA-1 hash value matches the actual hash value of the specified file. More... | |
static bool | CheckFileHashSha256 (string filePath, string hashValue) |
Checks whether the specified SHA-256 hash value matches the actual hash value of the specified file. More... | |
static bool | CheckFileHashSha512 (string filePath, string hashValue) |
Checks whether the specified SHA-512 hash value matches the actual hash value of the specified file. More... | |
Basic Cryptographic utilities.
$A Igor Apr10;
|
inlinestatic |
Returns length of the hash value, in bytes, for the specified hash algorithm.
-1 is returned if the length is not known.
hashType | Type of the hashing algorithm. |
|
inlinestatic |
Returns length of the HEXADECIMAL hash string for the specified hash algorithm.
-1 is returned if the length is not known.
hashType | Type of the hashing algorithm. |
|
inlinestatic |
Returns the appropriate hash algorithm according to the specified hash type, or null if the type is not recognized or the method is not implemented for that type.
hashType | Specification of the hash algorthm type. |
|
inlinestatic |
Referenced by IG.Script.ScriptAppBase.CryptoFunctionCheckSum().
|
inlinestatic |
Returns standard string representation of the specified hash type.
Does the same as HashTypeToString.
hashType | Hash type whose string representation is returned. |
|
inlinestatic |
Returns standard string representation of the specified hash type.
hashType | Hash type whose string representation is returned. |
|
inlinestatic |
Parses the file containing hash values of one or more files, and adds the parsed pairs {hash, filePath} to the specified list.
File must be in the standard format where each line contains a hash value and the path to the corresponding file separated from hash value by one or more spaces.
List is allocated if necessary. Eventual existent pairs on the list are not affected.
filePath | Path to the file that is parsed. |
hashList | List to which which parsed pairs {hash, filePath} are added in form of arrays of 2 strings. |
Example contents of the file:
595f44fec1e92a71d3e9e77456ba80d1 filetohashA.txt
71f920fa275127a7b60fa4d4d41432a3 filetohashB.txt
43c191bf6d6c3f263a8cd0efd4a058ab filetohashC.txt
/remarks>
Referenced by IG.Script.ScriptAppBase.CryptoFunctionCheckSum().
|
inlinestatic |
Parses the string containing hash values of one or more files, and adds the parsed pairs {hash, filePath} to the specified list.
String must be in the standard format where each line contains a hash value and the path to the corresponding file separated from hash value by one or more spaces.
List is allocated if necessary. Eventual existent pairs on the list are not affected.
str | String that is parsed. |
hashList | List to which which parsed pairs {hash, filePath} are added in form of arrays of 2 strings. |
Example contents of the string:
595f44fec1e92a71d3e9e77456ba80d1 filetohashA.txt
71f920fa275127a7b60fa4d4d41432a3 filetohashB.txt
43c191bf6d6c3f263a8cd0efd4a058ab filetohashC.txt
/remarks>
|
inlinestatic |
Computes and returns the hash string of the specified kind of the specified string.
null is returned if the specified hash type is not known or implemented.
stringToHash | String whose hash string is calculated. |
hashType | Specifies the type of the hashing algorithm to be used. |
Referenced by IG.Script.ScriptAppBase.CryptoFunctionCheckSum().
|
inlinestatic |
Computes and returns the SHA1 hash string of the specified string.
stringToHash | String whose cryptographic hash is calculated. |
Referenced by IG.Forms.HashGeneratorControl.CalculateHashes().
|
inlinestatic |
Computes and returns the SHA1 hash string of the specified string.
stringToHash | String whose cryptographic hash is calculated. |
Referenced by IG.Forms.HashGeneratorControl.CalculateHashes().
|
inlinestatic |
Computes and returns the SHA256 hash string of the specified string.
stringToHash | String whose cryptographic hash is calculated. |
Referenced by IG.Forms.HashGeneratorControl.CalculateHashes().
|
inlinestatic |
Computes and returns the SHA512 hash string of the specified string.
stringToHash | String whose cryptographic hash is calculated. |
Referenced by IG.Forms.HashGeneratorControl.CalculateHashes().
|
inlinestatic |
Chechs the specified type of hash value of a string.
Returns true if the hash value matches the hash value of the string, and false otherwise.
stringToCheck | String whose hash value is checked. |
hashValue | Supposed hash value whose correctness is checked. |
hashType | Type of the hash value that is checked. |
Referenced by IG.Script.ScriptAppBase.CryptoFunctionCheckSum().
|
inlinestatic |
Chechs all supported types of hash value of a string.
Returns the hash type if the hash value matches the hash value of that type of the specified string, or HashType.None if the specified hash value doesn't match the hash value of any supported type of the string.
stringToCheck | String whose hash value is checked. |
hashValue | Supposed hash value whose match with the specified string is checked. |
Referenced by IG.Forms.HashGeneratorControl.VerifyHash().
|
inlinestatic |
Checks whether the specified MD5 hash value matches the actual hash value of the specified string.
Returns true if the specified hash value matches the actual hash value of the string, and false otherwise.
stringToCheck | String whose hash value is checked. |
hashValue | Supposed hash value whose validity is checked for the specified string. |
|
inlinestatic |
Checks whether the specified SHA-1 hash value matches the actual hash value of the specified string.
Returns true if the specified hash value matches the actual hash value of the string, and false otherwise.
stringToCheck | String whose hash value is checked. |
hashValue | Supposed hash value whose validity is checked for the specified string. |
|
inlinestatic |
Checks whether the specified SHA-256 hash value matches the actual hash value of the specified string.
Returns true if the specified hash value matches the actual hash value of the string, and false otherwise.
stringToCheck | String whose hash value is checked. |
hashValue | Supposed hash value whose validity is checked for the specified string. |
|
inlinestatic |
Checks whether the specified SHA-512 hash value matches the actual hash value of the specified string.
Returns true if the specified hash value matches the actual hash value of the string, and false otherwise.
stringToCheck | String whose hash value is checked. |
hashValue | Supposed hash value whose validity is checked for the specified string. |
|
inlinestatic |
Computes and returns the hash string of specified type of the specified stream.
filePath | Path to the file whose contents' cryptographic hash is calculated. |
hashType | Specifies the type of the hashing algorithm to be used. |
Referenced by IG.Script.ScriptAppBase.CryptoFunctionCheckSum().
|
inlinestatic |
Computes and returns the MD5 hash string of the specified stream.
filePath | Path to the file whose contents' cryptographic hash is calculated. |
Referenced by IG.Forms.HashGeneratorControl.CalculateHashes(), and IG.Script.ScriptAppBase.CryptoFunctionGetFileHash().
|
inlinestatic |
Computes and returns the SHA1 hash string of the specified stream.
filePath | Path to the file whose contents' cryptographic hash is calculated. |
Referenced by IG.Forms.HashGeneratorControl.CalculateHashes(), and IG.Script.ScriptAppBase.CryptoFunctionGetFileHash().
|
inlinestatic |
Computes and returns the SHA256 hash string of the specified stream.
filePath | Path to the file whose contents' cryptographic hash is calculated. |
Referenced by IG.Forms.HashGeneratorControl.CalculateHashes(), and IG.Script.ScriptAppBase.CryptoFunctionGetFileHash().
|
inlinestatic |
Computes and returns the SHA512 hash string of the specified stream.
filePath | Path to the file whose contents' cryptographic hash is calculated. |
Referenced by IG.Forms.HashGeneratorControl.CalculateHashes(), and IG.Script.ScriptAppBase.CryptoFunctionGetFileHash().
|
inlinestatic |
Computes and returns the hash string of specified type of the specified stream.
stream | Stream whose contents' cryptographic hash is calculated. |
|
inlinestatic |
Computes and returns the MD5 hash string of the specified stream.
stream | Stream whose contents' cryptographic hash is calculated. |
|
inlinestatic |
Computes and returns the SHA1 hash string of the specified stream.
stream | Stream whose contents' cryptographic hash is calculated. |
|
inlinestatic |
Computes and returns the SHA256 hash string of the specified stream.
stream | Stream whose contents' cryptographic hash is calculated. |
|
inlinestatic |
Computes and returns the SHA512 hash string of the specified stream.
stream | Stream whose contents' cryptographic hash is calculated. |
|
inlinestatic |
Chechs the specified type of hash value of a file.
Returns true if the specified hash value matches the hash value of the file, and false otherwise.
filePath | Path to the file whose hash value is checked. |
hashValue | Supposed hash value whose correctness is checked. |
hashType | Type of the hash value that is checked. |
Referenced by IG.Script.ScriptAppBase.CryptoFunctionCheckSum().
|
inlinestatic |
Chechs all supported types of hash value of a file.
Returns the hash type if the hash value matches the hash value of that type of the specified file, or HashType.None if the specified hash value doesn't match the hash value of any supported type of the specified file.
filePath | Path to the file whose hash value is checked. |
hashValue | Supposed hash value whose match with the specified file is checked. |
Referenced by IG.Forms.HashGeneratorControl.VerifyHash().
|
inlinestatic |
Checks whether the specified MD5 hash value matches the actual hash value of the specified file.
Returns true if the specified hash value matches the actual hash value of the file, and false otherwise.
filePath | Path to the file whose hash value is checked. |
hashValue | Supposed hash value whose validity is checked for the specified file. |
|
inlinestatic |
Checks whether the specified SHA-1 hash value matches the actual hash value of the specified file.
Returns true if the specified hash value matches the actual hash value of the file, and false otherwise.
filePath | Path to the file whose hash value is checked. |
hashValue | Supposed hash value whose validity is checked for the specified file. |
|
inlinestatic |
Checks whether the specified SHA-256 hash value matches the actual hash value of the specified file.
Returns true if the specified hash value matches the actual hash value of the file, and false otherwise.
filePath | Path to the file whose hash value is checked. |
hashValue | Supposed hash value whose validity is checked for the specified file. |
|
inlinestatic |
Checks whether the specified SHA-512 hash value matches the actual hash value of the specified file.
Returns true if the specified hash value matches the actual hash value of the file, and false otherwise.
filePath | Path to the file whose hash value is checked. |
hashValue | Supposed hash value whose validity is checked for the specified file. |