Mercurial > libavutil.hg
comparison aes.c @ 726:5d344280a1f8 libavutil
cosmetics: Rename prn variable to prng (Pseudo Random Number Generator).
author | diego |
---|---|
date | Fri, 10 Apr 2009 17:23:38 +0000 |
parents | ae6e96434bec |
children | 567489a515b2 |
comparison
equal
deleted
inserted
replaced
725:d199c3b8cbd3 | 726:5d344280a1f8 |
---|---|
206 {0}}; | 206 {0}}; |
207 uint8_t rct[2][16]= { | 207 uint8_t rct[2][16]= { |
208 {0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7, 0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf}, | 208 {0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7, 0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf}, |
209 {0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65}}; | 209 {0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65}}; |
210 uint8_t temp[16]; | 210 uint8_t temp[16]; |
211 AVLFG prn; | 211 AVLFG prng; |
212 | 212 |
213 av_aes_init(&ae, "PI=3.141592654..", 128, 0); | 213 av_aes_init(&ae, "PI=3.141592654..", 128, 0); |
214 av_aes_init(&ad, "PI=3.141592654..", 128, 1); | 214 av_aes_init(&ad, "PI=3.141592654..", 128, 1); |
215 av_log_set_level(AV_LOG_DEBUG); | 215 av_log_set_level(AV_LOG_DEBUG); |
216 av_lfg_init(&prn, 1); | 216 av_lfg_init(&prng, 1); |
217 | 217 |
218 for(i=0; i<2; i++){ | 218 for(i=0; i<2; i++){ |
219 av_aes_init(&b, rkey[i], 128, 1); | 219 av_aes_init(&b, rkey[i], 128, 1); |
220 av_aes_crypt(&b, temp, rct[i], 1, NULL, 1); | 220 av_aes_crypt(&b, temp, rct[i], 1, NULL, 1); |
221 for(j=0; j<16; j++) | 221 for(j=0; j<16; j++) |
223 av_log(NULL, AV_LOG_ERROR, "%d %02X %02X\n", j, rpt[i][j], temp[j]); | 223 av_log(NULL, AV_LOG_ERROR, "%d %02X %02X\n", j, rpt[i][j], temp[j]); |
224 } | 224 } |
225 | 225 |
226 for(i=0; i<10000; i++){ | 226 for(i=0; i<10000; i++){ |
227 for(j=0; j<16; j++){ | 227 for(j=0; j<16; j++){ |
228 pt[j] = av_lfg_get(&prn); | 228 pt[j] = av_lfg_get(&prng); |
229 } | 229 } |
230 {START_TIMER | 230 {START_TIMER |
231 av_aes_crypt(&ae, temp, pt, 1, NULL, 0); | 231 av_aes_crypt(&ae, temp, pt, 1, NULL, 0); |
232 if(!(i&(i-1))) | 232 if(!(i&(i-1))) |
233 av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", temp[0], temp[5], temp[10], temp[15]); | 233 av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", temp[0], temp[5], temp[10], temp[15]); |