Zdes.h 802 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #ifndef _DES_ENCRYPT_DECRYPT
  3. #define _DES_ENCRYPT_DECRYPT
  4. #define BYTE unsigned char
  5. #define LPBYTE BYTE*
  6. #define LPCBYTE const BYTE*
  7. #define BOOL int
  8. class DES
  9. {
  10. public:
  11. BOOL CDesEnter(LPCBYTE in, LPBYTE out, int datalen, const BYTE key[8], BOOL type);
  12. BOOL CDesMac(LPCBYTE mac_data, LPBYTE mac_code, int datalen, const BYTE key[8]);
  13. private:
  14. void XOR(const BYTE in1[8], const BYTE in2[8], BYTE out[8]);
  15. LPBYTE Bin2ASCII(const BYTE byte[64], BYTE bit[8]);
  16. LPBYTE ASCII2Bin(const BYTE bit[8], BYTE byte[64]);
  17. void GenSubKey(const BYTE oldkey[8], BYTE newkey[16][8]);
  18. void endes(const BYTE m_bit[8], const BYTE k_bit[8], BYTE e_bit[8]);
  19. void undes(const BYTE m_bit[8], const BYTE k_bit[8], BYTE e_bit[8]);
  20. void SReplace(BYTE s_bit[8]);
  21. };
  22. #endif