|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
Go to the source code of this file.
Functions | |
| static uint32_t | swap32 (uint32_t x) |
| static void | lfg_forward (struct ngc_lfg_ctx *ctx) |
| static void | lfg_backward (struct ngc_lfg_ctx *ctx, size_t start_word, size_t end_word) |
| static bool | lfg_initialize (struct ngc_lfg_ctx *ctx, bool check_existing) |
| void | ngc_lfg_set_seed (struct ngc_lfg_ctx *ctx, const uint32_t seed[17]) |
| Initialize the LFG from a 17-word big-endian seed. | |
| void | ngc_lfg_get_bytes (struct ngc_lfg_ctx *ctx, uint8_t *out, size_t count) |
| Generate count bytes of junk data into out. | |
| static bool | lfg_reinitialize (struct ngc_lfg_ctx *ctx, uint32_t seed_out[17]) |
| size_t | ngc_lfg_get_seed (const uint8_t *data, size_t size, size_t data_offset, uint32_t seed_out[17]) |
| Try to extract the LFG seed from a chunk of data. | |
|
static |
< LFG second tap.
< LFG second tap.
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG second tap.
< LFG second tap.
< LFG second tap.
< LFG buffer size (number of uint32 words in state).
< LFG second tap.
Definition at line 36 of file lfg.c.
References ngc_lfg_ctx::buffer, NGC_LFG_J, and NGC_LFG_K.
Referenced by lfg_reinitialize(), and ngc_lfg_get_seed().
|
static |
< LFG second tap.
< LFG buffer size (number of uint32 words in state).
< LFG second tap.
< LFG second tap.
< LFG buffer size (number of uint32 words in state).
< LFG second tap.
Definition at line 29 of file lfg.c.
References ngc_lfg_ctx::buffer, NGC_LFG_J, and NGC_LFG_K.
Referenced by lfg_initialize(), ngc_lfg_get_bytes(), and ngc_lfg_get_seed().
|
static |
< Number of uint32 words needed to seed the LFG.
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
Definition at line 48 of file lfg.c.
References ngc_lfg_ctx::buffer, lfg_forward(), NGC_LFG_K, NGC_LFG_SEED_SIZE, and swap32().
Referenced by lfg_reinitialize(), and ngc_lfg_set_seed().
|
static |
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< Number of uint32 words needed to seed the LFG.
< Number of uint32 words needed to seed the LFG.
Definition at line 103 of file lfg.c.
References ngc_lfg_ctx::buffer, lfg_backward(), lfg_initialize(), NGC_LFG_K, NGC_LFG_SEED_SIZE, and swap32().
Referenced by ngc_lfg_get_seed().
| void ngc_lfg_get_bytes | ( | struct ngc_lfg_ctx * | ctx, |
| uint8_t * | out, | ||
| size_t | count ) |
Generate count bytes of junk data into out.
| ctx | LFG context (must be initialized via ngc_lfg_set_seed). |
| out | Output buffer to fill. |
| count | Number of bytes to generate. |
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
Definition at line 82 of file lfg.c.
References ngc_lfg_ctx::buffer, lfg_forward(), NGC_LFG_K, and ngc_lfg_ctx::position_bytes.
Referenced by ngcw_regenerate_junk_sector(), and wii_reconstruct_group_junk().
| size_t ngc_lfg_get_seed | ( | const uint8_t * | data, |
| size_t | size, | ||
| size_t | data_offset, | ||
| uint32_t | seed_out[17] ) |
Try to extract the LFG seed from a chunk of data.
Attempts to reverse-engineer the 17-word seed from a buffer of suspected PRNG output. Requires at least NGC_LFG_K * 4 = 2084 bytes of contiguous PRNG output aligned to uint32 boundaries.
| data | Pointer to the data to test. |
| size | Number of bytes available. |
| data_offset | Byte offset of data[0] within its LFG block (0x8000-aligned for Wii, arbitrary for GC). |
| seed_out | If successful, receives the 17-word seed (big-endian). |
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
< LFG buffer size (number of uint32 words in state).
Definition at line 121 of file lfg.c.
References ngc_lfg_ctx::buffer, lfg_backward(), lfg_forward(), lfg_reinitialize(), NGC_LFG_K, NGC_LFG_SEED_SIZE, ngc_lfg_ctx::position_bytes, and swap32().
| void ngc_lfg_set_seed | ( | struct ngc_lfg_ctx * | ctx, |
| const uint32_t | seed[17] ) |
Initialize the LFG from a 17-word big-endian seed.
| ctx | LFG context to initialize. |
| seed | Array of 17 uint32 seed words (big-endian). |
< Number of uint32 words needed to seed the LFG.
Definition at line 73 of file lfg.c.
References ngc_lfg_ctx::buffer, lfg_initialize(), NGC_LFG_SEED_SIZE, ngc_lfg_ctx::position_bytes, and swap32().
Referenced by ngcw_regenerate_junk_sector(), and wii_reconstruct_group_junk().
|
inlinestatic |
Definition at line 26 of file lfg.c.
Referenced by lfg_initialize(), lfg_reinitialize(), ngc_lfg_get_seed(), and ngc_lfg_set_seed().