encryption - Blowfish C example for char* -


i need in kocher's blowfish algorythm implement in c. url is(http://www.schneier.com/code/bfsh-koc.zip). basics (initialize), decryption isn't well. know should work longs, please me write char * function needs (char *encrypted_text) , returns decrypted text. thanks

here basics of encryption, how works in code depends on implementation:

do sort of initialization of state, include encryption key 56 bytes, set mode (cbc, ecb, etc)

feed machine (block size) byte chunks of data until out of data... sure pad end of data stream somehow 8 bytes...

now have completed can extract hash state...

see doesn't sound easy...

now 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 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; } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -