summaryrefslogtreecommitdiff
path: root/libdes/destest.c
blob: ad6333fa282a8662bad97209e833e36f70b566aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * $Source$
 * $Author$
 *
 * Copyright 1988 by the Massachusetts Institute of Technology.
 *
 * For copying and distribution information, please see the file
 * <mit-copyright.h>.
 */

#ifndef	lint
static char rcsid_destest_c[] =
    "$Id$";
#endif

#include <mit-copyright.h>
#include <stdio.h>
#include <des.h>

char clear[] = "eight bytes";
char cipher[8];
char key[8];
Key_schedule schedule;

main()
{
    int i;
    string_to_key("good morning!", key);
    i = key_sched(key, schedule);
    if (i) {
	printf("bad schedule (%d)\n", i);
	exit(1);
    }
    for (i = 1; i <= 10000; i++)
	des_ecb_encrypt(clear, cipher, schedule, i&1);
    return 0;
}