LIBKECCAK_DEGENERALISE_SPEC(3)

πŸ“¦ version 1.4.3, in arch rolling, opensuse-leap 16.0

πŸ’– 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 the libkeccak_spec_check(3) function after calling libkeccak_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 at 1600 bits. πŸ’€
  • LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_MOD_25 β€” the specified state size, in bits, was not equivalent to 0 modulus 25. 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 at 64 bits.
  • LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_WORD_INCOHERENCY β€” the specified state size is not exactly 25 times 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 to 0 modulus 8, 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 to 0 modulus 8, 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 (25 times 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:


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