.TH LIBHASHSUM_GET_ALGORITHM_FROM_STRING 3 libhashsum .SH NAME libhashsum_get_algorithm_from_string - identify named hash function .SH SYNOPSIS .nf #include \fBenum libhashsum_algorithm\fP { /* see the section DESCRIPTION for a listing of values */ }; int \fBlibhashsum_get_algorithm_from_string\fP(enum libhashsum_algorithm \fIalgorithm_out\fP, const char *\fIalgorithm\fP); .fi .PP Link with .IR -lhashsum . .SH DESCRIPTION The .B libhashsum_get_algorithm_from_string functions parses the string .I algorithm to identify the hash function it specifies, and stores one of the following values in .I *algorithm_out to indicate the specified hash function: .TP .B LIBHASHSUM_MD2 MD2 .I algorithm is .RB \(dq MD2 \(dq. .TP .B LIBHASHSUM_MD4 MD4 .I algorithm is .RB \(dq MD4 \(dq. .TP .B LIBHASHSUM_MD5 MD5 .I algorithm is .RB \(dq MD5 \(dq. .TP .B LIBHASHSUM_RIPEMD_128 RIPEMD-128 .I algorithm is .RB \(dq RIPEMD-128 \(dq or .RB \(dq RMD-128 \(dq. .TP .B LIBHASHSUM_RIPEMD_160 RIPEMD-160 .I algorithm is .RB \(dq RIPEMD-160 \(dq or .RB \(dq RMD-160 \(dq. .TP .B LIBHASHSUM_RIPEMD_256 RIPEMD-256 .I algorithm is .RB \(dq RIPEMD-256 \(dq or .RB \(dq RMD-256 \(dq. .TP .B LIBHASHSUM_RIPEMD_512 RIPEMD-512 .I algorithm is .RB \(dq RIPEMD-512 \(dq or .RB \(dq RMD-512 \(dq. .TP .B LIBHASHSUM_SHA0 SHA-0 .I algorithm is .RB \(dq SHA-0 \(dq. .TP .B LIBHASHSUM_SHA1 SHA-1 .I algorithm is .RB \(dq SHA-1 \(dq. .TP .B LIBHASHSUM_SHA_224 SHA-224 (32-bit SHA-2 with 224 bit output) .I algorithm is .RB \(dq SHA-224 \(dq or .RB \(dq SHA-2-224 \(dq. .TP .B LIBHASHSUM_SHA_256 SHA-256 (32-bit SHA-2 with 356 bit output) .I algorithm is .RB \(dq SHA-256 \(dq or .RB \(dq SHA-2-256 \(dq. .TP .B LIBHASHSUM_SHA_384 SHA-384 (64-bit SHA-2 with 384 bit output) .I algorithm is .RB \(dq SHA-384 \(dq or .RB \(dq SHA-2-384 \(dq. .TP .B LIBHASHSUM_SHA_512 SHA-512 (64-bit SHA-2 with 512 bit output) .I algorithm is .RB \(dq SHA-512 \(dq or .RB \(dq SHA-2-512 \(dq. .TP .B LIBHASHSUM_SHA_512_224 SHA-512/224 (64-bit SHA-2 with 224 bit output) .I algorithm is .RB \(dq SHA-512/224 \(dq or .RB \(dq SHA-2-512/224 \(dq, where the slash .RB (' / ') may be replaces with a dash .RB (' - ') or underscore .RB (' _ '). .TP .B LIBHASHSUM_SHA_512_256 SHA-512/256 (64-bit SHA-2 with 256 bit output) .I algorithm is .RB \(dq SHA-512/256 \(dq or .RB \(dq SHA-2-512/256 \(dq, where the slash .RB (' / ') may be replaces with a dash .RB (' - ') or underscore .RB (' _ '). .TP .B LIBHASHSUM_KECCAK Keccak .I algorithm is .RB \(dq Keccak \(dq. .TP .B LIBHASHSUM_KECCAK_224 Keccak-224 (Keccak[n=224]) .I algorithm is .RB \(dq Keccak-224 \(dq. .TP .B LIBHASHSUM_KECCAK_256 Keccak-256 (Keccak[n=256]) .I algorithm is .RB \(dq Keccak-256 \(dq. .TP .B LIBHASHSUM_KECCAK_384 Keccak-384 (Keccak[n=384]) .I algorithm is .RB \(dq Keccak-384 \(dq. .TP .B LIBHASHSUM_KECCAK_512 Keccak-512 (Keccak[n=512]) .I algorithm is .RB \(dq Keccak-512 \(dq. .TP .B LIBHASHSUM_SHA3_224 SHA-3-224 (SHA-3 with 224 bit output) .I algorithm is .RB \(dq SHA-3-224 \(dq. .TP .B LIBHASHSUM_SHA3_256 SHA-3-256 (SHA-3 with 256 bit output) .I algorithm is .RB \(dq SHA-3-256 \(dq. .TP .B LIBHASHSUM_SHA3_384 SHA-3-384 (SHA-3 with 384 bit output) .I algorithm is .RB \(dq SHA-3-384 \(dq. .TP .B LIBHASHSUM_SHA3_512 SHA-3-512 (SHA-3 with 512 bit output) .I algorithm is .RB \(dq SHA-3-512 \(dq. .TP .B LIBHASHSUM_SHAKE128 SHAKE128 (SHAKE with 256 bit capacity, and default output of 128 bits) .I algorithm is .RB \(dq SHAKE-128 \(dq. .TP .B LIBHASHSUM_SHAKE256 SHAKE128 (SHAKE with 512 bit capacity, and default output of 256 bits) .I algorithm is .RB \(dq SHAKE-256 \(dq. .TP .B LIBHASHSUM_SHAKE512 SHAKE128 (SHAKE with 1024 bit capacity, and default output of 512 bits) .I algorithm is .RB \(dq SHAKE-512 \(dq. .TP .B LIBHASHSUM_RAWSHAKE128 RawSHAKE128 (RawSHAKE with 256 bit capacity, and default output of 128 bits) .I algorithm is .RB \(dq RawSHAKE-128 \(dq. .TP .B LIBHASHSUM_RAWSHAKE256 RawSHAKE128 (RawSHAKE with 512 bit capacity, and default output of 256 bits) .I algorithm is .RB \(dq RawSHAKE-256 \(dq. .TP .B LIBHASHSUM_RAWSHAKE512 RawSHAKE128 (RawSHAKE with 1024 bit capacity, and default output of 512 bits) .I algorithm is .RB \(dq RawSHAKE-512 \(dq. .TP .B LIBHASHSUM_BLAKE224 BLAKE224 (BLAKEs (BLAKE) with 224 bit output) .I algorithm is .RB \(dq BLAKE-224 \(dq or .RB \(dq B224 \(dq. .TP .B LIBHASHSUM_BLAKE256 BLAKE256 (BLAKEs (BLAKE) with 256 bit output) .I algorithm is .RB \(dq BLAKE-256 \(dq or .RB \(dq B256 \(dq. .TP .B LIBHASHSUM_BLAKE384 BLAKE384 (BLAKEb (BLAKE) with 384 bit output) .I algorithm is .RB \(dq BLAKE-384 \(dq or .RB \(dq B384 \(dq. .TP .B LIBHASHSUM_BLAKE512 BLAKE512 (BLAKEb (BLAKE) with 512 bit output) .I algorithm is .RB \(dq BLAKE-512 \(dq or .RB \(dq B512 \(dq. .PP The function is case-insensitive, and tolerates skipping dashes .RB (' - ') that are not immediately after a digit. Additionally, it will ignore the substring .RB \(dq sum \(dq if it is added to the end of the function name. .PP The function .I does not validate the parameters for the hash function that may be places inside square brackets at the end of .IR algorithm . .PP .I algorithm_out and .I algorithm must not be .IR NULL . .SH RETURN VALUE The .B libhashsum_get_algorithm_from_string returns 1 if the hash function was identified. Otherwise the function returns 0. If 1 is returned, the .I *algoritm_out is set, otherwise .I *algoritm_out is unmodified. .SH ERRORS The .B libhashsum_get_algorithm_from_string function cannot fail. .SH HISTORY libhashsum 1.0. .SH SEE ALSO .BR libhashsum (7), .BR libhashsum_init_hasher_from_string (3)