57 for (
i = 0;
i < 12;
i++)
69 for (
i = 0;
i < 5;
i++)
71 for (
i = 6;
i < 11;
i++)
79 for (
i = 1;
i < 5;
i++) {
80 v = (v >> 16) | (v << 16);
91 for (
i = 4;
i > 0;
i--) {
93 v = (v >> 16) | (v << 16);
111 uint32_t
b =
data >> 32;
120 return ((uint64_t)
c << 32) |
tmp;
136 uint32_t
c =
data >> 32;
144 return ((uint64_t)
b << 32) |
a;
151 int num_qwords =
len >> 3;
153 uint64_t rc4buff[8] = { 0 };
155 uint32_t ms_keys[12];
175 packetkey =
AV_RN64(&qwords[num_qwords * 8 - 8]);
176 packetkey ^= rc4buff[7];
179 packetkey ^= rc4buff[6];
185 for (
i = 0;
i < num_qwords - 1;
i++, qwords += 8)
188 packetkey = (packetkey << 32) | (packetkey >> 32);
static uint64_t multiswap_dec(const uint32_t keys[12], uint64_t key, uint64_t data)
"MultiSwap" decryption
static uint32_t multiswap_step(const uint32_t keys[12], uint32_t v)
static uint32_t inverse(uint32_t v)
find multiplicative inverse modulo 2 ^ 32
static uint32_t multiswap_inv_step(const uint32_t keys[12], uint32_t v)
void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len)
static uint64_t multiswap_enc(const uint32_t keys[12], uint64_t key, uint64_t data)
"MultiSwap" encryption
static void multiswap_init(const uint8_t keybuf[48], uint32_t keys[12])
read keys from keybuf into keys
static void multiswap_invert_keys(uint32_t keys[12])
invert the keys so that encryption become decryption keys and the other way round.
common internal and external API header
int av_des_init(AVDES *d, const uint8_t *key, int key_bits, av_unused int decrypt)
AVDES * av_des_alloc(void)
Allocate an AVDES context.
void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Encrypts / decrypts using the DES algorithm.
int av_rc4_init(AVRC4 *r, const uint8_t *key, int key_bits, int decrypt)
Initializes an AVRC4 context.
AVRC4 * av_rc4_alloc(void)
Allocate an AVRC4 context.
void av_rc4_crypt(AVRC4 *r, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Encrypts / decrypts using the RC4 algorithm.