14 #define ROTL(x, y) (((x) << ((y) & (w - 1))) | ((x) >> (w - ((y) & (w - 1)))))
15 #define ROTR(x, y) (((x) >> ((y) & (w - 1))) | ((x) << (w - ((y) & (w - 1)))))
23 if (keylen != 128 / 8 && keylen != 192 / 8 && keylen != 256 / 8) {
37 ut32 A = 0,
B = 0,
k = 0, j = 0;
42 for (
i = 0;
i <
c;
i++) {
47 for (
i = 1;
i < t;
i++) {
51 for (
i = 0;
i <
v;
i++) {
58 state->key_size = keylen / 8;
73 ut32 A = data[0],
B = data[1],
C = data[2],
D = data[3];
79 for (
i = 1;
i <=
r;
i++) {
80 t =
ROTL(
B * (2 *
B + 1), 5);
81 u =
ROTL(
D * (2 *
D + 1), 5);
114 data[
i] |= ((
inbuf[
off++] & 0xff) << 16);
115 data[
i] |= ((
inbuf[
off++] & 0xff) << 24);
118 ut32 A = data[0],
B = data[1],
C = data[2],
D = data[3];
120 C =
C - (
state->S)[2 * (
r + 1) + 1];
123 for (
i =
r;
i >= 1;
i--) {
130 u =
ROTL(
D * (2 *
D + 1), 5);
131 t =
ROTL(
B * (2 *
B + 1), 5);
153 cry->
dir = direction;
166 return !strcmp(algo,
"rc6");
174 eprintf(
"Input should be multiple of 128bit.\n");
221 .author =
"rakholiyajenish.07",
232 #ifndef RZ_PLUGIN_INCORE
RZ_API int rz_crypto_append(RzCrypto *cry, const ut8 *buf, int len)
static bool rc6_set_key(RzCrypto *cry, const ut8 *key, int keylen, int mode, int direction)
static void rc6_decrypt(struct rc6_state *const state, const ut8 *inbuf, ut8 *outbuf)
static bool rc6_fini(RzCrypto *cry)
static bool update(RzCrypto *cry, const ut8 *buf, int len)
static void rc6_encrypt(struct rc6_state *const state, const ut8 *inbuf, ut8 *outbuf)
RZ_API RzLibStruct rizin_plugin
static bool rc6_use(const char *algo)
RzCryptoPlugin rz_crypto_plugin_rc6
static bool rc6_init(RzCrypto *cry)
static bool rc6_init_state(struct rc6_state *const state, const ut8 *key, int keylen)
static int rc6_get_key_size(RzCrypto *cry)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
unsigned char outbuf[SIZE]
unsigned char inbuf[SIZE]
RZ_API void Ht_() free(HtName_(Ht) *ht)
void * calloc(size_t number, size_t size)
#define rz_warn_if_reached()
#define rz_return_val_if_fail(expr, val)
static ut32 rz_read_at_le32(const void *src, size_t offset)
if(dbg->bits==RZ_SYS_BITS_64)
static unsigned char * obuf