Results 1 to 2 of 2
  1. #1
    ZER0MEM0RY's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Location
    \\\\.\\PhysicalDrive0
    Posts
    94
    Reputation
    10
    Thanks
    4,217
    My Mood
    Cold

    Post C++ AES Encryption | Advanced encryption

    What is AES? AES is abbreviation of "Advanced Encryption Standard", it was chosen to replace it's predecessor DES (Data Encryption Standard) by NIST ( National Institute of Standards and Technology) and has been adapted by the US government and most developers world wide. AES is considered the most secure encryption algorithm today, while it also being very lightweight and efficient.

    AES has block size of 128bits, meaning that if more data is wanted to be encrypted, it must be encrypted block by block.
    AES has 3 possible key sizes: 128, 192 and 256 bits.

    It would take 1 BILLION BILLION years for a supercomputer to bruteforce an AES 128 encryption.

    Even if a quantum computer that could make 72 000 000 000 000 000 key combinations per second (crazy much)
    it would still take 149 TRILLION years to break it!

    To put this in perspective, the UNIVERSE is only 13.8 billion years old.

    So AES is in practice unbreakable by the bruteforce method (and other known attacks).


    This is my implementation of the algorithm:
    (this code snippet demonstrates the CTR block cipher mode)
    ¨

    Code:
    #include "VirtualAES.h"
    #include <iostream>
    #include <windows.h>
    #include <time.h>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
    	/* All char arrays are null terminated here...*/
    	char cipherhex[256];
    	char decryptedhex[128];
    	uchar dechex[128];
    
    	uchar szkey[KEY_128] = "very strong key";
    	uchar szCiphertext[128];
    	uchar szDecryptedtext[128];
    	uchar szPlaintext[128] = 
    		"Sed ut perspiciatis unde omnis iste natus error sit voluptatem"
    		"accusantium doloremque laudantium, totam rem aperiam eaque ipsa.";
    	
    	aes_ctx_t *ctx;
    	u64 nonce;
    
    	virtualAES::initialize();
    	ctx = virtualAES::allocatectx(szkey, sizeof(szkey));
    	virtualAES::rand_nonce(&nonce);
    
    	/*encrypt*/
    	virtualAES::encrypt_ctr(ctx, szPlaintext, szCiphertext, sizeof(szPlaintext), nonce);
    	cout << "cipherdata in ansi:\n" << szCiphertext << "\n\n";
    	virtualAES::strtohex(szCiphertext, cipherhex, 128);
    	cout << "cipherdata in hex:\n" << cipherhex << "\n\n";
    	
    	/*previously encrypted hex to string for decrypting...*/
    	virtualAES::hextostr(
    		"340A0A94EA7BAA70A3672E5D47C2529AA0D7835CD1A5FDF45C  FD3D0945F705AC7FBEC8EF4FBB782B"
    		"710C4BE4C3EF8E4F418A3D213D81344192E4DE32907DB2FFCF  7D816764F8C84511AE3EB636C4BB23"
    		"D51820801A288360AD7B2A949D35C9B7631C4986333F6CE573  44B9EC909170BBA28CB10E41A7E722"
    		"5F241E54C5FACAE8", dechex, 128);
    	/*decrypt*/
    
    	virtualAES::decrypt_ctr(ctx, dechex, szDecryptedtext, sizeof(dechex), nonce);	
    	cout << "decrypted data in ansi:\n" << szDecryptedtext << "\n\n";
    	virtualAES::strtohex(szDecryptedtext, decryptedhex, 128);
    	cout << "decrypted data in hex:\n" << decryptedhex << endl;
    
    	getchar();
    	return EXIT_SUCCESS;
    }

    video tutorial (no CTR mode):



    - - - Updated - - -

    Sources:

    How long it will take to break AES?: https://www.eetimes.com/document.asp?doc_id=1279619
    general: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
    <b>Downloadable Files</b> Downloadable Files

  2. The Following 23 Users Say Thank You to ZER0MEM0RY For This Useful Post:

    3dsboy08 (05-06-2016),AidsMachine (11-13-2016),astemia (05-26-2018),connor231 (07-14-2018),counterstrikeforever (11-15-2015),ekrcu123 (11-21-2017),GeriatricGamer (09-30-2017),haiqalsj (08-23-2015),hetath (10-04-2015),Kvintus (08-04-2017),LonelyGrayWolf (06-17-2017),lovam123 (08-09-2017),maxthor2 (12-16-2017),mfakhrulsyafiq (12-15-2016),piaru (08-31-2016),pricacruph (01-03-2017),RetroBoy (06-18-2017),riskaamelia (11-30-2015),Ryuzaki™ (04-20-2016),SeagerCzech (11-24-2017),TrashFromSec (03-12-2017),ValerioSoftEngineer (07-23-2017),Vedere (04-02-2017)

  3. #2
    Mayion's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Location
    Bed
    Posts
    13,504
    Reputation
    4018
    Thanks
    8,372
    My Mood
    Twisted
    /Approved.
    I do not use any type of messenger outside of MPGH.
    Inactive but you can reach me through VM/PM.










     

    Donator - 30 August 2013
    Battlefield Minion - 26 October 2013

    Blackshot Minion - 14 January 2014/16 September 2014
    Minecraft Minion - 7 February 2014/16 September 2014
    WarRock Minion - 23 February 2014
    League of Legends Minion - 21 March 2014

    Minion+ - 15 May 2014
    Other Semi-Popular First Person Shooter Minion - 8 August 2014
    CrossFire Minion - 23 October 2014
    Programming Section Minion - 13 November 2014
    Marketplace Minion - 7 December 2014

    Official Middleman - 7 December 2014 - 27 June 2015
    Moderator - 29 December 2014
    Project Blackout Minion - 10 January 2015
    News Force Interviewer - January 2015
    Steam Games Minion - 21 March 2015
    Dragon Nest Minion - 31 March 2015
    Publicist - April 2015 - 21 September 2015
    Global Moderator - 25 August 2015
    Super User - 13 August 2016



Similar Threads

  1. Replies: 0
    Last Post: 04-12-2013, 12:48 AM
  2. [release] my aer-246 aes encryption | decryption program
    By cosconub in forum C# Programming
    Replies: 9
    Last Post: 02-02-2011, 06:01 PM
  3. Encrypting Trainers
    By nub_g0t_high in forum WarRock - International Hacks
    Replies: 1
    Last Post: 11-10-2007, 01:24 PM
  4. Basic Encryption
    By Calard in forum General Game Hacking
    Replies: 0
    Last Post: 02-23-2007, 06:32 AM
  5. Encryption on Files
    By HolyFate in forum Gunz General
    Replies: 15
    Last Post: 02-20-2006, 01:50 PM

Tags for this Thread