join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
hmac_test.cpp File Reference
#include <join/hmac.hpp>
#include <gtest/gtest.h>
Include dependency graph for hmac_test.cpp:

Functions

const std::string key (65, 'a')
 key.
 
 TEST (Hmac, finalize)
 Test finalize.
 
 TEST (Hmac, md5bin)
 Test md5bin.
 
 TEST (Hmac, md5hex)
 Test md5hex.
 
 TEST (Hmac, sha1bin)
 Test sha1bin.
 
 TEST (Hmac, sha1hex)
 Test sha1hex.
 
 TEST (Hmac, sha224bin)
 Test sha224bin.
 
 TEST (Hmac, sha224hex)
 Test sha224hex.
 
 TEST (Hmac, sha256bin)
 Test sha256bin.
 
 TEST (Hmac, sha256hex)
 Test sha256hex.
 
 TEST (Hmac, sha384bin)
 Test sha384bin.
 
 TEST (Hmac, sha384hex)
 Test sha384hex.
 
 TEST (Hmac, sha512bin)
 Test sha512bin.
 
 TEST (Hmac, sha512hex)
 Test sha512hex.
 
 TEST (Hmac, sm3bin)
 Test sm3bin.
 
 TEST (Hmac, sm3hex)
 Test sm3hex.
 
int main (int argc, char **argv)
 main function.
 

Variables

const std::string sample
 sample text.
 
BytesArray md5bin
 keyed-hash message authentication code in binary format.
 
BytesArray sha1bin
 
BytesArray sha224bin
 
BytesArray sha256bin
 
BytesArray sha384bin
 
BytesArray sha512bin
 
BytesArray sm3bin
 
const std::string md5hex = "d38cc14908acaca11f83f98337ea7614"
 keyed-hash message authentication code in hexadecimal format.
 
const std::string sha1hex = "ea279e14cdbfb68d30e2fefc5aa71325f4845abd"
 
const std::string sha224hex = "2b56d6be15511224c06f29e82992ff1ff193e4e452a036d2738df958"
 
const std::string sha256hex = "f7d289a6280433fbe77d76fbf6651a097e9b6a53b94d6d958fb4579593454195"
 
const std::string sha384hex = "6a1663644d1276cf28b2d5ce059962302fa56a057c830c17d6d32a45e608d65719254a0f043372b5d4ab3188c0fe1bab"
 
const std::string sha512hex = "9d73a7160b32d250c4a92fcc070aa74c865cf3c7d4fec0fcffb8ed36520d255cf12e4faf99496eef8a978647da85af8ca8c645815e3865a30506ebb9012cbc5c"
 
const std::string sm3hex = "10d95529e4d8bb1fc98514151a361ac5f3ad58f04ed5db4affc8459d5e63a697"
 

Function Documentation

◆ key()

const std::string key ( 65 ,
'a'  )

key.

◆ main()

int main ( int argc,
char ** argv )

main function.

◆ TEST() [1/15]

TEST ( Hmac ,
finalize  )

Test finalize.

◆ TEST() [2/15]

TEST ( Hmac ,
md5bin  )

Test md5bin.

◆ TEST() [3/15]

TEST ( Hmac ,
md5hex  )

Test md5hex.

◆ TEST() [4/15]

TEST ( Hmac ,
sha1bin  )

Test sha1bin.

◆ TEST() [5/15]

TEST ( Hmac ,
sha1hex  )

Test sha1hex.

◆ TEST() [6/15]

TEST ( Hmac ,
sha224bin  )

Test sha224bin.

◆ TEST() [7/15]

TEST ( Hmac ,
sha224hex  )

Test sha224hex.

◆ TEST() [8/15]

TEST ( Hmac ,
sha256bin  )

Test sha256bin.

◆ TEST() [9/15]

TEST ( Hmac ,
sha256hex  )

Test sha256hex.

◆ TEST() [10/15]

TEST ( Hmac ,
sha384bin  )

Test sha384bin.

◆ TEST() [11/15]

TEST ( Hmac ,
sha384hex  )

Test sha384hex.

◆ TEST() [12/15]

TEST ( Hmac ,
sha512bin  )

Test sha512bin.

◆ TEST() [13/15]

TEST ( Hmac ,
sha512hex  )

Test sha512hex.

◆ TEST() [14/15]

TEST ( Hmac ,
sm3bin  )

Test sm3bin.

◆ TEST() [15/15]

TEST ( Hmac ,
sm3hex  )

Test sm3hex.

Variable Documentation

◆ md5bin

BytesArray md5bin
Initial value:
= {
0xd3, 0x8c, 0xc1, 0x49, 0x08, 0xac, 0xac, 0xa1,
0x1f, 0x83, 0xf9, 0x83, 0x37, 0xea, 0x76, 0x14
}

keyed-hash message authentication code in binary format.

◆ md5hex

const std::string md5hex = "d38cc14908acaca11f83f98337ea7614"

keyed-hash message authentication code in hexadecimal format.

◆ sample

const std::string sample
Initial value:
= "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "
"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

sample text.

◆ sha1bin

BytesArray sha1bin
Initial value:
= {
0xea, 0x27, 0x9e, 0x14, 0xcd, 0xbf, 0xb6, 0x8d,
0x30, 0xe2, 0xfe, 0xfc, 0x5a, 0xa7, 0x13, 0x25,
0xf4, 0x84, 0x5a, 0xbd
}

◆ sha1hex

const std::string sha1hex = "ea279e14cdbfb68d30e2fefc5aa71325f4845abd"

◆ sha224bin

BytesArray sha224bin
Initial value:
= {
0x2b, 0x56, 0xd6, 0xbe, 0x15, 0x51, 0x12, 0x24,
0xc0, 0x6f, 0x29, 0xe8, 0x29, 0x92, 0xff, 0x1f,
0xf1, 0x93, 0xe4, 0xe4, 0x52, 0xa0, 0x36, 0xd2,
0x73, 0x8d, 0xf9, 0x58
}

◆ sha224hex

const std::string sha224hex = "2b56d6be15511224c06f29e82992ff1ff193e4e452a036d2738df958"

◆ sha256bin

BytesArray sha256bin
Initial value:
= {
0xf7, 0xd2, 0x89, 0xa6, 0x28, 0x04, 0x33, 0xfb,
0xe7, 0x7d, 0x76, 0xfb, 0xf6, 0x65, 0x1a, 0x09,
0x7e, 0x9b, 0x6a, 0x53, 0xb9, 0x4d, 0x6d, 0x95,
0x8f, 0xb4, 0x57, 0x95, 0x93, 0x45, 0x41, 0x95
}

◆ sha256hex

const std::string sha256hex = "f7d289a6280433fbe77d76fbf6651a097e9b6a53b94d6d958fb4579593454195"

◆ sha384bin

BytesArray sha384bin
Initial value:
= {
0x6a, 0x16, 0x63, 0x64, 0x4d, 0x12, 0x76, 0xcf,
0x28, 0xb2, 0xd5, 0xce, 0x05, 0x99, 0x62, 0x30,
0x2f, 0xa5, 0x6a, 0x05, 0x7c, 0x83, 0x0c, 0x17,
0xd6, 0xd3, 0x2a, 0x45, 0xe6, 0x08, 0xd6, 0x57,
0x19, 0x25, 0x4a, 0x0f, 0x04, 0x33, 0x72, 0xb5,
0xd4, 0xab, 0x31, 0x88, 0xc0, 0xfe, 0x1b, 0xab
}

◆ sha384hex

const std::string sha384hex = "6a1663644d1276cf28b2d5ce059962302fa56a057c830c17d6d32a45e608d65719254a0f043372b5d4ab3188c0fe1bab"

◆ sha512bin

BytesArray sha512bin
Initial value:
= {
0x9d, 0x73, 0xa7, 0x16, 0x0b, 0x32, 0xd2, 0x50,
0xc4, 0xa9, 0x2f, 0xcc, 0x07, 0x0a, 0xa7, 0x4c,
0x86, 0x5c, 0xf3, 0xc7, 0xd4, 0xfe, 0xc0, 0xfc,
0xff, 0xb8, 0xed, 0x36, 0x52, 0x0d, 0x25, 0x5c,
0xf1, 0x2e, 0x4f, 0xaf, 0x99, 0x49, 0x6e, 0xef,
0x8a, 0x97, 0x86, 0x47, 0xda, 0x85, 0xaf, 0x8c,
0xa8, 0xc6, 0x45, 0x81, 0x5e, 0x38, 0x65, 0xa3,
0x05, 0x06, 0xeb, 0xb9, 0x01, 0x2c, 0xbc, 0x5c
}

◆ sha512hex

const std::string sha512hex = "9d73a7160b32d250c4a92fcc070aa74c865cf3c7d4fec0fcffb8ed36520d255cf12e4faf99496eef8a978647da85af8ca8c645815e3865a30506ebb9012cbc5c"

◆ sm3bin

BytesArray sm3bin
Initial value:
= {
0x10, 0xd9, 0x55, 0x29, 0xe4, 0xd8, 0xbb, 0x1f,
0xc9, 0x85, 0x14, 0x15, 0x1a, 0x36, 0x1a, 0xc5,
0xf3, 0xad, 0x58, 0xf0, 0x4e, 0xd5, 0xdb, 0x4a,
0xff, 0xc8, 0x45, 0x9d, 0x5e, 0x63, 0xa6, 0x97
}

◆ sm3hex

const std::string sm3hex = "10d95529e4d8bb1fc98514151a361ac5f3ad58f04ed5db4affc8459d5e63a697"