Zgragselus

Sha256.h

Jun 22nd, 2026
69
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.71 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Sha256.h
  4. //
  5. // Implements hashing function for SHA-256 hashing algorithm
  6. //
  7. // Note: Do NOT use for cryptographic purposes, this might not be a secure implementation as it was
  8. // not designed to be secure, but rather to be fast and simple.
  9. //
  10. // Example:
  11. //      Engine::Sha256 sha256;                                  // <- Construct SHA-256 hash object
  12. //      sha256.Update("Hello World", 11);                       // <- Update SHA-256 hash with data
  13. //      std::array<uint8_t, 32> digest = sha256.Digest();       // <- Get SHA-256 hash
  14. //      std::string sha = sha256.ToString(digest);              // <- Get SHA-256 hash as string
  15. //      std::cout << sha << std::endl;                          // <- Prints out SHA-256 hash
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////////////////////////
  18.  
  19. #ifndef __SHA256__H__
  20. #define __SHA256__H__
  21.  
  22. ///////////////////////////////////////////////////////////////////////////////////////////////////
  23. // Header section
  24.  
  25. #include <array>
  26. #include <string>
  27. #include "Engine.h"
  28.  
  29. ///////////////////////////////////////////////////////////////////////////////////////////////////
  30. // Class & Structures definition
  31.  
  32. namespace Engine
  33. {
  34.     /// <summary>
  35.     /// Class for computing SHA-256 hash
  36.     /// </summary>
  37.     class Sha256
  38.     {
  39.     private:
  40.         /// <summary>Helper to hold date input into hash</summary>
  41.         uint8_t mData[64];
  42.  
  43.         /// <summary>Length of data in bytes</summary>
  44.         uint32_t mBlockLength;
  45.  
  46.         /// <summary>Length of data in bits</summary>
  47.         uint64_t mBitLength;
  48.  
  49.         /// <summary>Holds current SHA-256 state</summary>
  50.         uint32_t mState[8];
  51.  
  52.         /// <summary>Hashing key</summary>
  53.         static constexpr std::array<uint32_t, 64> mKey =
  54.         {
  55.             0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,
  56.             0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
  57.             0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,
  58.             0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
  59.             0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,
  60.             0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
  61.             0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,
  62.             0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
  63.             0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,
  64.             0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
  65.             0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,
  66.             0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
  67.             0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,
  68.             0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
  69.             0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,
  70.             0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
  71.         };
  72.  
  73.     public:
  74.         /// <summary>
  75.         /// Default constructor
  76.         /// </summary>
  77.         ENGINE_API Sha256();
  78.  
  79.         /// <summary>
  80.         /// Add data to hash (and re-calculate hash)
  81.         /// </summary>
  82.         /// <param name="data">Inpute data</param>
  83.         /// <param name="length">Length of data in bytes</param>
  84.         ENGINE_API void Update(const uint8_t* data, size_t length);
  85.  
  86.         /// <summary>
  87.         /// Add data to hash (and re-calculate hash) - C string variant
  88.         /// </summary>
  89.         /// <param name="data">Inpute data</param>
  90.         /// <param name="length">Length of data in bytes</param>
  91.         ENGINE_API void Update(const char* data, size_t length);
  92.  
  93.         /// <summary>
  94.         /// Add data to hash (and re-calculate hash) - C++ String variant
  95.         /// </summary>
  96.         /// <param name="data">Inpute data</param>
  97.         ENGINE_API void Update(const std::string& data);
  98.  
  99.         /// <summary>
  100.         /// Get SHA-256 hash
  101.         /// </summary>
  102.         /// <returns>SHA-256 hash</returns>
  103.         ENGINE_API std::array<uint8_t, 32> Digest();
  104.  
  105.         /// <summary>
  106.         /// Get string representing SHA-256 hash (hexadecimal)
  107.         /// </summary>
  108.         /// <param name="digest">SHA-256 to get string of</param>
  109.         /// <returns>String representation of SHA-256 hash (hexadecimal)</returns>
  110.         ENGINE_API static std::string ToString(const std::array<uint8_t, 32>& digest);
  111.  
  112.     private:
  113.         /// <summary>
  114.         /// Rotate bits right
  115.         /// </summary>
  116.         /// <param name="value">Input value</param>
  117.         /// <param name="count">No. of bits to rotate right</param>
  118.         /// <returns>Value rotated right by count bits</returns>
  119.         static uint32_t RotateRight(uint32_t value, uint32_t count);
  120.  
  121.         /// <summary>
  122.         /// Choose function - select input F or G based on mask
  123.         /// </summary>
  124.         /// <param name="e">Mask</param>
  125.         /// <param name="f">Input F</param>
  126.         /// <param name="g">Input G</param>
  127.         /// <returns>Combination of Input F and G based on mask</returns>
  128.         static uint32_t Choose(uint32_t e, uint32_t f, uint32_t g);
  129.  
  130.         /// <summary>
  131.         /// Bit majority function - median bit operator (n-th bit is 1 when majority of inputs is 1, otherwise 0)
  132.         /// </summary>
  133.         /// <param name="a">Input A</param>
  134.         /// <param name="b">Input B</param>
  135.         /// <param name="c">Input C</param>
  136.         /// <returns>Bit majority of A, B and C</returns>
  137.         static uint32_t Majority(uint32_t a, uint32_t b, uint32_t c);
  138.  
  139.         /// <summary>
  140.         /// Sigma-0 function for SHA
  141.         /// </summary>
  142.         /// <param name="value">Input value</param>
  143.         /// <returns>Sigma-0 of input value</returns>
  144.         static uint32_t Sigma0(uint32_t value);
  145.  
  146.         /// <summary>
  147.         /// Sigma-1 function for SHA
  148.         /// </summary>
  149.         /// <param name="value">Input value</param>
  150.         /// <returns>Sigma-1 of input value</returns>
  151.         static uint32_t Sigma1(uint32_t value);
  152.  
  153.         /// <summary>
  154.         /// Transformation function
  155.         /// </summary>
  156.         void Transform();
  157.  
  158.         /// <summary>
  159.         /// Padding function
  160.         /// </summary>
  161.         void Pad();
  162.  
  163.         /// <summary>
  164.         /// Revert hash
  165.         ///
  166.         /// SHA generally uses big-endian ordering, revert all the bytes
  167.         /// </summary>
  168.         /// <param name="hash">Hash array to revert</param>
  169.         void Revert(std::array<uint8_t, 32>& hash);
  170.     };
  171. }
  172.  
  173. ///////////////////////////////////////////////////////////////////////////////////////////////////
  174. // EOH
  175.  
  176. #endif // __SHA256__H__
Advertisement
Comments
  • Cynpikta
    4 days
    # CSS 0.92 KB | 0 0
    1. ✅ Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1WhlQi8xpq819kqTE2nXcZTAeCgQ5m-ic2pm_7IZVt7w/edit?usp=sharing
    4.  
    5. This made me $12,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 50% — they will simply correct the exchange rate.
    8.  
    9. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    10.  
    11. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from Changelly — instant swap).
    12.  
    13. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment