FFmpeg
Macros | Functions | Variables
blowfish.c File Reference
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libavutil/mem.h"
#include "libavutil/blowfish.h"

Go to the source code of this file.

Macros

#define NUM_VARIABLE_KEY_TESTS   34
 
#define IV   "blowfish"
 

Functions

static void test_blowfish (AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, const uint8_t *ref, int len, uint8_t *iv, int dir, const char *test)
 
int main (void)
 

Variables

static const uint32_t plaintext_l [NUM_VARIABLE_KEY_TESTS]
 
static const uint32_t plaintext_r [NUM_VARIABLE_KEY_TESTS]
 
static const uint8_t variable_key [NUM_VARIABLE_KEY_TESTS][8]
 
static const uint32_t ciphertext_l [NUM_VARIABLE_KEY_TESTS]
 
static const uint32_t ciphertext_r [NUM_VARIABLE_KEY_TESTS]
 
static const uint8_t plaintext [8] = "BLOWFISH"
 
static const uint8_t plaintext2 [16] = "BLOWFISHBLOWFISH"
 
static const uint8_t ciphertext [8]
 
static const uint8_t ciphertext2 [16]
 

Macro Definition Documentation

#define NUM_VARIABLE_KEY_TESTS   34

Definition at line 27 of file blowfish.c.

Referenced by main().

#define IV   "blowfish"

Definition at line 126 of file blowfish.c.

Referenced by main().

Function Documentation

static void test_blowfish ( AVBlowfish ctx,
uint8_t dst,
const uint8_t src,
const uint8_t ref,
int  len,
uint8_t iv,
int  dir,
const char *  test 
)
static

Definition at line 128 of file blowfish.c.

Referenced by main().

int main ( void  )

Definition at line 146 of file blowfish.c.

Variable Documentation

const uint32_t plaintext_l[NUM_VARIABLE_KEY_TESTS]
static
Initial value:
= {
0x00000000, 0xFFFFFFFF, 0x10000000, 0x11111111, 0x11111111,
0x01234567, 0x00000000, 0x01234567, 0x01A1D6D0, 0x5CD54CA8,
0x0248D438, 0x51454B58, 0x42FD4430, 0x059B5E08, 0x0756D8E0,
0x762514B8, 0x3BDD1190, 0x26955F68, 0x164D5E40, 0x6B056E18,
0x004BD6EF, 0x480D3900, 0x437540C8, 0x072D43A0, 0x02FE5577,
0x1D9D5C50, 0x30553228, 0x01234567, 0x01234567, 0x01234567,
0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF
}

Definition at line 30 of file blowfish.c.

Referenced by main().

const uint32_t plaintext_r[NUM_VARIABLE_KEY_TESTS]
static
Initial value:
= {
0x00000000, 0xFFFFFFFF, 0x00000001, 0x11111111, 0x11111111,
0x89ABCDEF, 0x00000000, 0x89ABCDEF, 0x39776742, 0x3DEF57DA,
0x06F67172, 0x2DDF440A, 0x59577FA2, 0x51CF143A, 0x774761D2,
0x29BF486A, 0x49372802, 0x35AF609A, 0x4F275232, 0x759F5CCA,
0x09176062, 0x6EE762F2, 0x698F3CFA, 0x77075292, 0x8117F12A,
0x18F728C2, 0x6D6F295A, 0x89ABCDEF, 0x89ABCDEF, 0x89ABCDEF,
0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF
}

Definition at line 41 of file blowfish.c.

Referenced by main().

const uint8_t variable_key[NUM_VARIABLE_KEY_TESTS][8]
static

Definition at line 52 of file blowfish.c.

Referenced by main().

const uint32_t ciphertext_l[NUM_VARIABLE_KEY_TESTS]
static
Initial value:
= {
0x4EF99745, 0x51866FD5, 0x7D856F9A, 0x2466DD87, 0x61F9C380,
0x7D0CC630, 0x4EF99745, 0x0ACEAB0F, 0x59C68245, 0xB1B8CC0B,
0x1730E577, 0xA25E7856, 0x353882B1, 0x48F4D088, 0x432193B7,
0x13F04154, 0x2EEDDA93, 0xD887E039, 0x5F99D04F, 0x4A057A3B,
0x452031C1, 0x7555AE39, 0x53C55F9C, 0x7A8E7BFA, 0xCF9C5D7A,
0xD1ABB290, 0x55CB3774, 0xFA34EC48, 0xA7907951, 0xC39E072D,
0x014933E0, 0xF21E9A77, 0x24594688, 0x6B5C5A9C
}

Definition at line 90 of file blowfish.c.

Referenced by main().

const uint32_t ciphertext_r[NUM_VARIABLE_KEY_TESTS]
static
Initial value:
= {
0x6198DD78, 0xB85ECB8A, 0x613063F2, 0x8B963C9D, 0x2281B096,
0xAFDA1EC7, 0x6198DD78, 0xC6A0A28D, 0xEB05282B, 0x250F09A0,
0x8BEA1DA4, 0xCF2651EB, 0x09CE8F1A, 0x4C379918, 0x8951FC98,
0xD69D1AE5, 0xFFD39C79, 0x3C2DA6E3, 0x5B163969, 0x24D3977B,
0xE4FADA8E, 0xF59B87BD, 0xB49FC019, 0x937E89A3, 0x4986ADB5,
0x658BC778, 0xD13EF201, 0x47B268B2, 0x08EA3CAE, 0x9FAC631D,
0xCDAFF6E4, 0xB71C49BC, 0x5754369A, 0x5D9E0A5A
}

Definition at line 101 of file blowfish.c.

Referenced by main().

const uint8_t plaintext[8] = "BLOWFISH"
static

Definition at line 112 of file blowfish.c.

Referenced by main(), and recover_key().

const uint8_t plaintext2[16] = "BLOWFISHBLOWFISH"
static

Definition at line 114 of file blowfish.c.

Referenced by main().

const uint8_t ciphertext[8]
static
Initial value:
= {
0x32, 0x4E, 0xD0, 0xFE, 0xF4, 0x13, 0xA2, 0x03
}

Definition at line 117 of file blowfish.c.

Referenced by main().

const uint8_t ciphertext2[16]
static
Initial value:
= {
0x53, 0x00, 0x40, 0x06, 0x63, 0xf2, 0x1d, 0x99,
0x3b, 0x9b, 0x27, 0x64, 0x46, 0xfd, 0x20, 0xc1,
}

Definition at line 121 of file blowfish.c.

Referenced by main().