LIBKECCAK_DEGENERALISE_SPEC(3)
π NAME π
okay so bestie, this is the Library Functions Manual entry for libkeccak_degeneralise_spec(3) β and its whole thing is: set all specification parameters to automatic. periodt. β¨
π¦ SYNOPSIS π¦
#include <libkeccak.h>
int libkeccak_degeneralise_spec(struct libkeccak_generalised_spec *spec, struct libkeccak_spec *output_spec);
Link with -lkeccak, obviously. π
πΈ DESCRIPTION πΈ
The libkeccak_degeneralise_spec() function resolves the automatic parameters inside *spec and translates the parameters into *output_spec, so that it can be used for hashing. slay.
Heads up though: this function is not shy β it modifies both *spec and *output_spec. π«Ά
π You should call thelibkeccak_spec_check(3)function after callinglibkeccak_degeneralise_spec(). Do not skip the vibe check, bestie.
And the struct in question is literally this:
struct libkeccak_generalised_spec {
long int bitrate; /* bitrate (in bits) */
long int capacity; /* capacity (in bits) */
long int output; /* output size (in bits) */
long int state_size; /* state size (in bits) */
long int word_size; /* word size (in bits) */
};
π RETURN VALUES π
The libkeccak_degeneralise_spec() function returns 0 if the settings are usable. Otherwise it will return one of these constants, and yes, you need to know all of them:
LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_NONPOSITIVEβ the specified state size is non-positive. πLIBKECCAK_GENERALISED_SPEC_ERROR_STATE_TOO_LARGEβ the specified state size exceeded the supported limit, which is currently at1600bits. πLIBKECCAK_GENERALISED_SPEC_ERROR_STATE_MOD_25β the specified state size, in bits, was not equivalent to0modulus25. Meaning the state size cannot cover all lanes equivalently. π§LIBKECCAK_GENERALISED_SPEC_ERROR_WORD_NONPOSITIVEβ the specified word size is non-positive.LIBKECCAK_GENERALISED_SPEC_ERROR_WORD_TOO_LARGEβ the specified word size exceeded the supported limit, which is currently at64bits.LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_WORD_INCOHERENCYβ the specified state size is not exactly25times larger than the word size. not the math not mathing πLIBKECCAK_GENERALISED_SPEC_ERROR_CAPACITY_NONPOSITIVEβ the specified capacity was non-positive.LIBKECCAK_GENERALISED_SPEC_ERROR_CAPACITY_MOD_8β the specified capacity was not equivalent to0modulus8, that is, it was not in whole bytes.LIBKECCAK_GENERALISED_SPEC_ERROR_BITRATE_NONPOSITIVEβ the specified bitrate was non-positive.LIBKECCAK_GENERALISED_SPEC_ERROR_BITRATE_MOD_8β the specified bitrate was not equivalent to0modulus8, that is, it was not in whole bytes.LIBKECCAK_GENERALISED_SPEC_ERROR_OUTPUT_NONPOSITIVEβ the specified output size was non-positive.LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_BITRATE_CAPACITY_INCONSISTENCYβ the sum of the bitrate and the capacity does not equal the state size (25times the word size). π₯
π Note that there may be more than one error. Only the first detected is returned.
β ERRORS β
The libkeccak_degeneralise_spec() function cannot fail. That is the whole section, bestie. iconic.
π₯ EXAMPLE π₯
This example configures a struct libkeccak_spec to specify settings for Keccak[c = 512]:
int r;
struct libkeccak_spec spec;
struct libkeccak_generalised_spec gspec;
libkeccak_generalised_spec_initialise(&gspec);
gspec.capacity = 512;
if ((r = libkeccak_degeneralise_spec(&gspec, &spec)))
goto fail_degeneralise_spec;
if ((r = libkeccak_spec_check(&spec)));
goto fail_spec_check;
π SEE ALSO π
go read these too, iykyk:
libkeccak_generalised_spec_initialise(3)libkeccak_spec_check(3)libkeccak_spec_cshake(3)libkeccak_spec_sha3(3)libkeccak_spec_rawshake(3)libkeccak_spec_shake(3)libkeccak_state_initialise(3)libkeccak_hmac_initialise(3)
k bye bestie π β source/version: LIBKECCAK, page: libkeccak_degeneralise_spec(3). The footer didn't show a date, so I'm not inventing one, no cap. π«Άβ¨
π¦ where this page comes from
- arch rolling: libkeccak 1.4.3-1 Β· custom:ISC
- opensuse-leap 16.0: libkeccak-devel 1.4-bp160.1.13 Β· ISC
- opensuse-leap 16.0: libkeccak-devel 1.4-bp160.1.13 Β· ISC
- opensuse-leap 16.0: libkeccak-devel 1.4-bp160.1.13 Β· ISC
- opensuse-leap 16.0: libkeccak-devel 1.4-bp160.1.13 Β· ISC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms