Loading...
Searching...
No Matches
crypto1.h
1#pragma once
2
3#include <protocols/mf_classic/mf_classic.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10typedef struct {
11 uint32_t odd;
12 uint32_t even;
13} Crypto1;
14
15Crypto1* crypto1_alloc(void);
16
17void crypto1_free(Crypto1* instance);
18
19void crypto1_reset(Crypto1* crypto1);
20
21void crypto1_init(Crypto1* crypto1, uint64_t key);
22
23uint8_t crypto1_bit(Crypto1* crypto1, uint8_t in, int is_encrypted);
24
25uint8_t crypto1_byte(Crypto1* crypto1, uint8_t in, int is_encrypted);
26
27uint32_t crypto1_word(Crypto1* crypto1, uint32_t in, int is_encrypted);
28
29void crypto1_decrypt(Crypto1* crypto, const BitBuffer* buff, BitBuffer* out);
30
31void crypto1_encrypt(Crypto1* crypto, uint8_t* keystream, const BitBuffer* buff, BitBuffer* out);
32
33void crypto1_encrypt_reader_nonce(
34 Crypto1* crypto,
35 uint64_t key,
36 uint32_t cuid,
37 uint8_t* nt,
38 uint8_t* nr,
39 BitBuffer* out,
40 bool is_nested);
41
42uint32_t crypto1_lfsr_rollback_word(Crypto1* crypto1, uint32_t in, int fb);
43
44bool crypto1_nonce_matches_encrypted_parity_bits(uint32_t nt, uint32_t ks, uint8_t nt_par_enc);
45
46bool crypto1_is_weak_prng_nonce(uint32_t nonce);
47
48uint32_t crypto1_decrypt_nt_enc(uint32_t cuid, uint32_t nt_enc, MfClassicKey known_key);
49
50uint32_t crypto1_prng_successor(uint32_t x, uint32_t n);
51
52#ifdef __cplusplus
53}
54#endif
Bit Buffer.
Definition bit_buffer.c:7
Definition crypto1.h:10
Definition mf_classic.h:87