FFmpeg
cast5.c File Reference
#include "cast5.h"
#include "common.h"
#include "attributes.h"

Go to the source code of this file.

struct  AVCAST5

Macros

#define IA(x)   ((x) >> 24)

#define IB(x)   (((x) >> 16) & 0xff)

#define IC(x)   (((x) >> 8) & 0xff)

#define ID(x)   ((x) & 0xff)

#define LR(x, c)   (((x) << (c)) | ((x) >> (32 - (c))))

#define F3(l, r, i)

#define F2(l, r, i)

#define F1(l, r, i)

#define COMPUTE_Z

#define COMPUTE_X

Functions

static void generate_round_keys (int rnds, uint32_t *K, uint32_t *x, uint32_t *z)

static void encipher (AVCAST5 *cs, uint8_t *dst, const uint8_t *src)

static void decipher (AVCAST5 *cs, uint8_t *dst, const uint8_t *src, uint8_t *iv)

struct AVCAST5av_cast5_alloc (void)
Allocate an AVCAST5 context To free the struct: av_free(ptr) More...

av_cold int av_cast5_init (AVCAST5 *cs, const uint8_t *key, int key_bits)
Initialize an AVCAST5 context. More...

void av_cast5_crypt2 (AVCAST5 *cs, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Encrypt or decrypt a buffer using a previously initialized context. More...

void av_cast5_crypt (AVCAST5 *cs, uint8_t *dst, const uint8_t *src, int count, int decrypt)
Encrypt or decrypt a buffer using a previously initialized context, ECB mode only. More...

Variables

const int av_cast5_size = sizeof(AVCAST5)

static const uint32_t S1 

static const uint32_t S2 

static const uint32_t S3 

static const uint32_t S4 

static const uint32_t S5 

static const uint32_t S6 

static const uint32_t S7 

static const uint32_t S8 

Macro Definition Documentation

 #define IA ( x ) ((x) >> 24)

Definition at line 26 of file cast5.c.

Referenced by generate_round_keys().

 #define IB ( x ) (((x) >> 16) & 0xff)

Definition at line 27 of file cast5.c.

Referenced by generate_round_keys().

 #define IC ( x ) (((x) >> 8) & 0xff)

Definition at line 28 of file cast5.c.

Referenced by generate_round_keys().

 #define ID ( x ) ((x) & 0xff)

Definition at line 29 of file cast5.c.

Referenced by generate_round_keys().

 #define LR ( x, c ) (((x) << (c)) | ((x) >> (32 - (c))))

Definition at line 31 of file cast5.c.

 #define F3 ( l, r, i )
Value:
do { \
I = LR(cs->Km[i] - r, cs->Kr[i]); \
f = ((S1[IA(I)] + S2[IB(I)]) ^ S3[IC(I)]) - S4[ID(I)]; \
l = f ^ l; \
} while (0)
static const uint32_t S4
Definition: cast5.c:184
#define IA(x)
Definition: cast5.c:26
#define LR(x, c)
Definition: cast5.c:31
const char * r
Definition: vf_curves.c:107
#define IC(x)
Definition: cast5.c:28
static const uint32_t S3
Definition: cast5.c:149
static const uint32_t S1
Definition: cast5.c:79
#define ID(x)
Definition: cast5.c:29
#define IB(x)
Definition: cast5.c:27
static const uint32_t S2
Definition: cast5.c:114

Definition at line 33 of file cast5.c.

Referenced by decipher(), and encipher().

 #define F2 ( l, r, i )
Value:
do { \
I = LR(cs->Km[i] ^ r, cs->Kr[i]); \
f = ((S1[IA(I)] - S2[IB(I)]) + S3[IC(I)]) ^ S4[ID(I)]; \
l = f ^ l; \
} while (0)
static const uint32_t S4
Definition: cast5.c:184
#define IA(x)
Definition: cast5.c:26
#define LR(x, c)
Definition: cast5.c:31
const char * r
Definition: vf_curves.c:107
#define IC(x)
Definition: cast5.c:28
static const uint32_t S3
Definition: cast5.c:149
static const uint32_t S1
Definition: cast5.c:79
#define ID(x)
Definition: cast5.c:29
#define IB(x)
Definition: cast5.c:27
static const uint32_t S2
Definition: cast5.c:114

Definition at line 40 of file cast5.c.

Referenced by decipher(), and encipher().

 #define F1 ( l, r, i )
Value:
do { \
I = LR(cs->Km[i] + r, cs->Kr[i]); \
f = ((S1[IA(I)] ^ S2[IB(I)]) - S3[IC(I)]) + S4[ID(I)]; \
l = f ^ l; \
} while (0)
static const uint32_t S4
Definition: cast5.c:184
#define IA(x)
Definition: cast5.c:26
#define LR(x, c)
Definition: cast5.c:31
const char * r
Definition: vf_curves.c:107
#define IC(x)
Definition: cast5.c:28
static const uint32_t S3
Definition: cast5.c:149
static const uint32_t S1
Definition: cast5.c:79
#define ID(x)
Definition: cast5.c:29
#define IB(x)
Definition: cast5.c:27
static const uint32_t S2
Definition: cast5.c:114

Definition at line 47 of file cast5.c.

Referenced by decipher(), and encipher().

 #define COMPUTE_Z
Value:
do { \
z = x ^ S5[IB(x)] ^ S6[ID(x)] ^ S7[IA(x)] ^ S8[IC(x)] ^ S7[IA(x)]; \
z = x ^ S5[IA(z)] ^ S6[IC(z)] ^ S7[IB(z)] ^ S8[ID(z)] ^ S8[IC(x)]; \
z = x ^ S5[ID(z)] ^ S6[IC(z)] ^ S7[IB(z)] ^ S8[IA(z)] ^ S5[IB(x)]; \
z = x ^ S5[IC(z)] ^ S6[IB(z)] ^ S7[ID(z)] ^ S8[IA(z)] ^ S6[ID(x)]; \
} while (0)
#define IA(x)
Definition: cast5.c:26
#define IC(x)
Definition: cast5.c:28
static const uint32_t S5
Definition: cast5.c:219
#define ID(x)
Definition: cast5.c:29
static const uint32_t S7
Definition: cast5.c:289
static const uint32_t S8
Definition: cast5.c:324
#define IB(x)
Definition: cast5.c:27
static const uint32_t S6
Definition: cast5.c:254

Definition at line 54 of file cast5.c.

Referenced by generate_round_keys().

 #define COMPUTE_X
Value:
do { \
x = z ^ S5[IB(z)] ^ S6[ID(z)] ^ S7[IA(z)] ^ S8[IC(z)] ^ S7[IA(z)]; \
x = z ^ S5[IA(x)] ^ S6[IC(x)] ^ S7[IB(x)] ^ S8[ID(x)] ^ S8[IC(z)]; \
x = z ^ S5[ID(x)] ^ S6[IC(x)] ^ S7[IB(x)] ^ S8[IA(x)] ^ S5[IB(z)]; \
x = z ^ S5[IC(x)] ^ S6[IB(x)] ^ S7[ID(x)] ^ S8[IA(x)] ^ S6[ID(z)]; \
} while (0)
#define IA(x)
Definition: cast5.c:26
#define IC(x)
Definition: cast5.c:28
static const uint32_t S5
Definition: cast5.c:219
#define ID(x)
Definition: cast5.c:29
static const uint32_t S7
Definition: cast5.c:289
static const uint32_t S8
Definition: cast5.c:324
#define IB(x)
Definition: cast5.c:27
static const uint32_t S6
Definition: cast5.c:254

Definition at line 62 of file cast5.c.

Referenced by generate_round_keys().

Function Documentation

 static void generate_round_keys ( int rnds, uint32_t * K, uint32_t * x, uint32_t * z )
static

Definition at line 359 of file cast5.c.

Referenced by av_cast5_init().

 static void encipher ( AVCAST5 * cs, uint8_t * dst, const uint8_t * src )
static

Definition at line 392 of file cast5.c.

Referenced by av_cast5_crypt(), and av_cast5_crypt2().

 static void decipher ( AVCAST5 * cs, uint8_t * dst, const uint8_t * src, uint8_t * iv )
static

Definition at line 419 of file cast5.c.

Referenced by av_cast5_crypt(), and av_cast5_crypt2().

Variable Documentation

 const uint32_t S1
static

Definition at line 79 of file cast5.c.

 const uint32_t S2
static

Definition at line 114 of file cast5.c.

 const uint32_t S3
static

Definition at line 149 of file cast5.c.

 const uint32_t S4
static

Definition at line 184 of file cast5.c.

 const uint32_t S5
static

Definition at line 219 of file cast5.c.

Referenced by generate_round_keys().

 const uint32_t S6
static

Definition at line 254 of file cast5.c.

Referenced by generate_round_keys().

 const uint32_t S7
static

Definition at line 289 of file cast5.c.

Referenced by generate_round_keys().

 const uint32_t S8
static

Definition at line 324 of file cast5.c.

Referenced by generate_round_keys().
{"ft_lang_label":"__label__en","ft_lang_prob":0.58214694,"math_prob":0.9777787,"size":3227,"snap":"2022-05-2022-21","text_gpt3_token_len":1029,"char_repetition_ratio":0.16909711,"word_repetition_ratio":0.25263157,"special_character_ratio":0.36287573,"punctuation_ratio":0.1851211,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9628883,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-01-23T18:26:04Z\",\"WARC-Record-ID\":\"<urn:uuid:936b5c67-6147-4dfb-89bf-0673eabe80ac>\",\"Content-Length\":\"66376\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9c02ec10-31f1-4c47-b4f1-a6ec9577f8d4>\",\"WARC-Concurrent-To\":\"<urn:uuid:53dff7aa-0b65-4a5f-9b93-f362cd42c135>\",\"WARC-IP-Address\":\"79.124.17.100\",\"WARC-Target-URI\":\"https://www.ffmpeg.org/doxygen/3.0/cast5_8c.html\",\"WARC-Payload-Digest\":\"sha1:CGNYPNOCEA5KYQOLXUJSL7JIJLYGVD43\",\"WARC-Block-Digest\":\"sha1:JBVW3NOUZF5AB4VQ7LKQ77EXLCCVVA75\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-05/CC-MAIN-2022-05_segments_1642320304309.5_warc_CC-MAIN-20220123172206-20220123202206-00275.warc.gz\"}"}