java - encryption program -
i need idea creatin encryption program can 1 help!? need create program in java or c++ need create logic encryption prog should automatically encrypt document n should decrypt if givien conditions such password fulfilled ! plz !
i agree fielding. in case want homework, think it's ok use xor encryption:
java sample code:
public string xorenc(int enckey, string toenc) { /* usage: str = xorenc(integer_key,string_to_encrypt); created matthew shaffer (matt-shaffer.com) */ int t=0; string s1=""; string tog=""; if(enckey>0) { while(t < toenc.length()) { int a=toenc.charat(t); int c=a ^ enckey; char d=(char)c; tog=tog+d; t++; } } return tog; } public string xorencstr(string enckey, string toenc) { /* usage: str = xorenc(string_key,string_to_encrypt); created matthew shaffer (matt-shaffer.com) */ int t=0; int enckeyi=0; while(t < enckey.length()) { enckeyi+=enckey.charat(t); t+=1; } return xorenc(enckeyi,toenc); }
you may want start decryption process if correct password entered, should somehow store hash of decryption password on encrypted file. example encrypted file may this:
[md5 hash of password][encrypted data]
then compare entered password hash 1 have saved, if they're identical start decryption process.
Comments
Post a Comment