프로젝트
소개
C++로 구현한 AES
보안 및 개인정보 보호측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +2
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalAES
C++ AES(Advanced Encryption Standard) implementation
Usage
This class is very simple to use:
...
unsigned char plain[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; //plaintext example
unsigned char key[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; //key example
unsigned int plainLen = 16 * sizeof(unsigned char); //bytes in plaintext
AES aes(AESKeyLength::AES_128); // 128 - key length, can be 128, 192 or 256
c = aes.EncryptECB(plain, plainLen, key);
// now variable c contains plainLen bytes - ciphertext
...
delete[] c;
Or for vectors:
...
vector<unsigned char> plain = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; //plaintext example
vector<unsigned char> key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; //key example
AES aes(AESKeyLength::AES_128);
c = aes.EncryptECB(plain, key);
// now vector c contains ciphertext
...
ECB, CBC, CFB modes are supported.
Important notes
- This library does not provide any padding. Plaintext and ciphertext length in bytes must be divisible by 16. If length doesn't satisfy this condition exception will be thrown. You can use any padding before encryption if necessary
- This library does not provide any key derivation function. Key length must 128/192/256 bits respectively. You can use any KDF before encryption if necessary
Links
Development:
git clone https://github.com/SergeyBel/AES.gitdocker-compose up -d- use make commands
There are four executables in bin folder:
test- run testsdebug- version for debugging (main code will be taken from dev/main.cpp)profile- version for profiling with gprof (main code will be taken from dev/main.cpp)speedtest- performance speed test (main code will be taken from speedtest/main.cpp)release- version with optimization (main code will be taken from dev/main.cpp)
Build commands:
make build_all- build all targetsmake build_test- buildtesttargetmake build_debug- builddebugtargetmake build_profile- buildprofiletargetmake build_speed_test- buildspeedtesttargetmake build_release- buildreleasetargetmake style_fix- fix code stylemake test- run testsmake debug- run debug versionmake profile- run profile versionmake speed_test- run performance speed testmake release- runreleaseversionmake clean- cleanbindirectory
관련 프로젝트 살펴보기
불러오는 중…