03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
0
|
// util/crypt.h, version 0.1.2 |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
1
|
// Crypt header file from libutil |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
2
|
// Copyright (C) 2021, Jakob Wakeling |
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
3
|
// MIT Licence |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
4
|
|
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
5
|
#ifndef UTIL_CRYPT_H_RDY6J5JV |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
6
|
#define UTIL_CRYPT_H_RDY6J5JV |
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
7
|
|
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
8
|
#ifdef __cplusplus |
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
9
|
extern "C" { |
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
10
|
#endif |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
11
|
|
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
12
|
#include <stdint.h> |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
13
|
|
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
14
|
/* Circular shift left */ |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
15
|
#define ROL8(x, n) (uint8_t)(((x) << (n)) | ((x) >> (8 - (n)))) |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
16
|
#define ROL16(x, n) (uint16_t)(((x) << (n)) | ((x) >> (16 - (n)))) |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
17
|
#define ROL32(x, n) (uint32_t)(((x) << (n)) | ((x) >> (32 - (n)))) |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
18
|
#define ROL64(x, n) (uint64_t)(((x) << (n)) | ((x) >> (64 - (n)))) |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
19
|
|
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
20
|
/* Circular shift right */ |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
21
|
#define ROR8(x, n) (uint8_t)(((x) >> (n)) | ((x) << (8 - (n)))) |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
22
|
#define ROR16(x, n) (uint16_t)(((x) >> (n)) | ((x) << (16 - (n)))) |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
23
|
#define ROR32(x, n) (uint32_t)(((x) >> (n)) | ((x) << (32 - (n)))) |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
24
|
#define ROR64(x, n) (uint64_t)(((x) >> (n)) | ((x) << (64 - (n)))) |
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
25
|
|
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
26
|
#ifdef __cplusplus |
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
27
|
} // extern "C" |
03b01d2 |
Jamozed |
2022-03-06 17:10:01 |
28
|
#endif |
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
29
|
|
c01a723 |
Jamozed |
2022-02-05 19:04:03 |
30
|
#endif // UTIL_CRYPT_H_RDY6J5JV |
|
|
|
31
|
|