here are the basics of encryption, how it works in code depends on the implementation:
do some sort of initialization of state, include the encryption key up to 56 bytes, set up the mode (cbc, ecb, etc)
feed into your machine (Block Size) byte chunks of data until you are out of data... be sure to pad the end of the data stream somehow to get to 8 bytes...
now that your have completed you can extract the hash from the state...
see doesn't that sound easy...
now an openSSL example:
void *source = "12345678";
size_t len = strlen(source);
assert(len % BF_BLOCK == 0);
void *dest = malloc(len);
BF_KEY key;
BF_set_key(&key, 5, "12345"); // make a key
while(len > 0) {
BF_ecb_encrypt(source, dest, key, 1);// or other BF function see docs.
source += BF_BLOCK;
dest += BF_BLOCK;
len -= BF_BLOCK;
}