Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unsigned long long encryptDESplain(unsigned long long plain, unsigned long long *subKeys){
  2.  
  3. unsigned long long nova_plain = ip(plain);// primeira permuta (retira bits paridade)
  4. unsigned long long dir = nova_plain & 0xFFFFFFFF;//comparamos 32 bits
  5. unsigned long long esq = (nova_plain >>32) & 0xFFFFFFFF;//comparamos os 32 bits da esquerda
  6. unsigned long long plain_final = 0;
  7. int j = 0;
  8.  
  9. for (j;j<16;j++){
  10. dir = nova_plain & 0xFFFFFFFF;
  11. esq = (nova_plain >> 32) & 0xFFFFFFFF;
  12. esq=esq ^ function_p(function_s(function_e(dir)^subKeys[j]));
  13. nova_plain = (dir << 32) | esq;
  14. }
  15. esq = (nova_plain << 32) & 0xFFFFFFFF00000000;
  16. dir = (nova_plain >> 32) & 0xFFFFFFFF;
  17. plain_final= dir | esq;
  18.  
  19. return IP1(plain_final);
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement