Advertisement
Reptor7

CA52.h - v0.4

Jun 2nd, 2016
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.84 KB | None | 0 0
  1. /*
  2.   ca52.h (C/C++)
  3.   CA52 - Compression Algorithm 52 - ("Compress Area 52") - Header
  4.   Coded & Developed by [DA2K] Reptor * youtube.com/c/reptorultra7
  5. */
  6.  
  7. #define CA52HEAD_SIG 0x52CA     // CA 52 (bugfix:reversed order!)
  8. #define CA52STRM_LEN 0xFFFF     // 65535 Bytes (64K)
  9. #define CA52DATA_LEN 0x00FFFFFF // 16777215 Bytes (16MB)
  10.  
  11. // Custom Variable Types
  12. #define uchar unsigned char  //  8-bit byte (00..FF/255)
  13. #define uword unsigned short // 16-bit word (00..FFFF/65535)
  14. #define ulong unsigned long  // 32-bit word (00..FFFFFFFF/4294967295)
  15.  
  16. // File Header (5 Bytes)
  17. typedef struct { // word integers are stored in little-endian (lo,hi)
  18.   uword Sig;     // CA52 Header Signature (Magic Number CA52HEAD_SIG)
  19.   uword DataLen; // Length of Packed Data Stream (1..65535 Bytes)
  20.   uchar Method;  // Compression Method (see CA52METHOD[])
  21. } CA52HEADER;
  22.  
  23. // Compression Methods
  24. const uchar CA52METHOD[4] = {
  25.   0xEF, // "Ethereum Frontier": mostly packed http-URLs for BTC/ETH
  26.   0x25, // "2-Step": packed stream crunched twice for better ratio!
  27.   0xCD, // "Compressed Dictionary": w/macros, for packed ASCII text
  28.   0x7E  // "Zetauri WAV Crunch": highly compressed *.WAV audio data
  29. };
  30.  
  31. // Global Variables
  32. uchar CA52STREAM [CA52STRM_LEN]; // packed stream (input)
  33. uchar CA52BUFFER [CA52STRM_LEN]; // buffered data (temporary)
  34. uchar CA52OUTPUT [CA52DATA_LEN]; // uncompressed  (output)
  35. bool  IsCA52; // used for checks
  36.  
  37. /*
  38.   Initial Version 0.1 (2015-08-28)
  39.   * URL: pastie.org/pastes/10394287
  40.   * MD5: 6482deb2020c1edb82d16f256b1c0fa5
  41.  
  42.   Revised Version 0.2 (2015-09-15)
  43.   * URL: pastebin.com/Cu6EKsX1
  44.   * MD5: a3a5fa8a2bdb32389387acbea8ae75c8
  45.  
  46.   Updated Version 0.3 (2015-12-11)
  47.   * URL: pastebin.com/1zh50698
  48.   * MD5: 68f0a19f93d2ab424a72607e689db382
  49.  
  50.   Updated Version 0.4 (2016-06-02)
  51.   * URL: pastebin.com/1e5TsfGT
  52.   * MD5: (n/a)
  53. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement