libcryptx-perl/t/mac_f9.t

91 lines
9.2 KiB
Perl
Raw Permalink Normal View History

2018-03-22 15:51:09 +01:00
### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
use strict;
use warnings;
2018-03-22 15:54:03 +01:00
use Test::More tests => 72 + 8;
2018-03-22 15:51:09 +01:00
use Crypt::Mac::F9 qw( f9 f9_hex f9_b64 f9_b64u );
is( unpack('H*', Crypt::Mac::F9->new('AES','1234567890123456')->add("")->mac), 'd7d52d77795c5057977939f22fcce305', 'F9/oo+raw/1');
is( Crypt::Mac::F9->new('AES','1234567890123456')->add("")->hexmac, 'd7d52d77795c5057977939f22fcce305', 'F9/oo+hex/1');
is( unpack('H*', f9('AES','1234567890123456',"")), 'd7d52d77795c5057977939f22fcce305', 'F9/func+raw/1');
is( f9_hex('AES','1234567890123456',""), 'd7d52d77795c5057977939f22fcce305', 'F9/func+hex/1');
is( f9_b64('AES','1234567890123456',""), '19Utd3lcUFeXeTnyL8zjBQ==', 'F9/func+b64/1');
is( f9_b64u('AES','1234567890123456',""), '19Utd3lcUFeXeTnyL8zjBQ', 'F9/func+b64u/1');
is( unpack('H*', Crypt::Mac::F9->new('AES','12345678901234561234567890123456')->add("")->mac), 'd8186a166fafc2aa245f15155bcb889f', 'F9/oo+raw/2');
is( Crypt::Mac::F9->new('AES','12345678901234561234567890123456')->add("")->hexmac, 'd8186a166fafc2aa245f15155bcb889f', 'F9/oo+hex/2');
is( unpack('H*', f9('AES','12345678901234561234567890123456',"")), 'd8186a166fafc2aa245f15155bcb889f', 'F9/func+raw/2');
is( f9_hex('AES','12345678901234561234567890123456',""), 'd8186a166fafc2aa245f15155bcb889f', 'F9/func+hex/2');
is( f9_b64('AES','12345678901234561234567890123456',""), '2BhqFm+vwqokXxUVW8uInw==', 'F9/func+b64/2');
is( f9_b64u('AES','12345678901234561234567890123456',""), '2BhqFm-vwqokXxUVW8uInw', 'F9/func+b64u/2');
is( unpack('H*', Crypt::Mac::F9->new('Blowfish','1234567890123456')->add("")->mac), '063daede33be0e37', 'F9/oo+raw/3');
is( Crypt::Mac::F9->new('Blowfish','1234567890123456')->add("")->hexmac, '063daede33be0e37', 'F9/oo+hex/3');
is( unpack('H*', f9('Blowfish','1234567890123456',"")), '063daede33be0e37', 'F9/func+raw/3');
is( f9_hex('Blowfish','1234567890123456',""), '063daede33be0e37', 'F9/func+hex/3');
is( f9_b64('Blowfish','1234567890123456',""), 'Bj2u3jO+Djc=', 'F9/func+b64/3');
is( f9_b64u('Blowfish','1234567890123456',""), 'Bj2u3jO-Djc', 'F9/func+b64u/3');
is( unpack('H*', Crypt::Mac::F9->new('Blowfish','12345678901234561234567890123456')->add("")->mac), '063daede33be0e37', 'F9/oo+raw/4');
is( Crypt::Mac::F9->new('Blowfish','12345678901234561234567890123456')->add("")->hexmac, '063daede33be0e37', 'F9/oo+hex/4');
is( unpack('H*', f9('Blowfish','12345678901234561234567890123456',"")), '063daede33be0e37', 'F9/func+raw/4');
is( f9_hex('Blowfish','12345678901234561234567890123456',""), '063daede33be0e37', 'F9/func+hex/4');
is( f9_b64('Blowfish','12345678901234561234567890123456',""), 'Bj2u3jO+Djc=', 'F9/func+b64/4');
is( f9_b64u('Blowfish','12345678901234561234567890123456',""), 'Bj2u3jO-Djc', 'F9/func+b64u/4');
is( unpack('H*', Crypt::Mac::F9->new('AES','1234567890123456')->add(123)->mac), 'b3ec60e084566cd17423b3636d395f30', 'F9/oo+raw/5');
is( Crypt::Mac::F9->new('AES','1234567890123456')->add(123)->hexmac, 'b3ec60e084566cd17423b3636d395f30', 'F9/oo+hex/5');
is( unpack('H*', f9('AES','1234567890123456',123)), 'b3ec60e084566cd17423b3636d395f30', 'F9/func+raw/5');
is( f9_hex('AES','1234567890123456',123), 'b3ec60e084566cd17423b3636d395f30', 'F9/func+hex/5');
is( f9_b64('AES','1234567890123456',123), 's+xg4IRWbNF0I7NjbTlfMA==', 'F9/func+b64/5');
is( f9_b64u('AES','1234567890123456',123), 's-xg4IRWbNF0I7NjbTlfMA', 'F9/func+b64u/5');
is( unpack('H*', Crypt::Mac::F9->new('AES','12345678901234561234567890123456')->add(123)->mac), 'ea9a400b9a8dceaec669c1dea926d567', 'F9/oo+raw/6');
is( Crypt::Mac::F9->new('AES','12345678901234561234567890123456')->add(123)->hexmac, 'ea9a400b9a8dceaec669c1dea926d567', 'F9/oo+hex/6');
is( unpack('H*', f9('AES','12345678901234561234567890123456',123)), 'ea9a400b9a8dceaec669c1dea926d567', 'F9/func+raw/6');
is( f9_hex('AES','12345678901234561234567890123456',123), 'ea9a400b9a8dceaec669c1dea926d567', 'F9/func+hex/6');
is( f9_b64('AES','12345678901234561234567890123456',123), '6ppAC5qNzq7GacHeqSbVZw==', 'F9/func+b64/6');
is( f9_b64u('AES','12345678901234561234567890123456',123), '6ppAC5qNzq7GacHeqSbVZw', 'F9/func+b64u/6');
is( unpack('H*', Crypt::Mac::F9->new('Blowfish','1234567890123456')->add(123)->mac), '1fdb454cb94a332b', 'F9/oo+raw/7');
is( Crypt::Mac::F9->new('Blowfish','1234567890123456')->add(123)->hexmac, '1fdb454cb94a332b', 'F9/oo+hex/7');
is( unpack('H*', f9('Blowfish','1234567890123456',123)), '1fdb454cb94a332b', 'F9/func+raw/7');
is( f9_hex('Blowfish','1234567890123456',123), '1fdb454cb94a332b', 'F9/func+hex/7');
is( f9_b64('Blowfish','1234567890123456',123), 'H9tFTLlKMys=', 'F9/func+b64/7');
is( f9_b64u('Blowfish','1234567890123456',123), 'H9tFTLlKMys', 'F9/func+b64u/7');
is( unpack('H*', Crypt::Mac::F9->new('Blowfish','12345678901234561234567890123456')->add(123)->mac), '1fdb454cb94a332b', 'F9/oo+raw/8');
is( Crypt::Mac::F9->new('Blowfish','12345678901234561234567890123456')->add(123)->hexmac, '1fdb454cb94a332b', 'F9/oo+hex/8');
is( unpack('H*', f9('Blowfish','12345678901234561234567890123456',123)), '1fdb454cb94a332b', 'F9/func+raw/8');
is( f9_hex('Blowfish','12345678901234561234567890123456',123), '1fdb454cb94a332b', 'F9/func+hex/8');
is( f9_b64('Blowfish','12345678901234561234567890123456',123), 'H9tFTLlKMys=', 'F9/func+b64/8');
is( f9_b64u('Blowfish','12345678901234561234567890123456',123), 'H9tFTLlKMys', 'F9/func+b64u/8');
is( unpack('H*', Crypt::Mac::F9->new('AES','1234567890123456')->add("test\0test\0test\n")->mac), '9fa4876ee09966ff8c1ae43b05e0b155', 'F9/oo+raw/9');
is( Crypt::Mac::F9->new('AES','1234567890123456')->add("test\0test\0test\n")->hexmac, '9fa4876ee09966ff8c1ae43b05e0b155', 'F9/oo+hex/9');
is( unpack('H*', f9('AES','1234567890123456',"test\0test\0test\n")), '9fa4876ee09966ff8c1ae43b05e0b155', 'F9/func+raw/9');
is( f9_hex('AES','1234567890123456',"test\0test\0test\n"), '9fa4876ee09966ff8c1ae43b05e0b155', 'F9/func+hex/9');
is( f9_b64('AES','1234567890123456',"test\0test\0test\n"), 'n6SHbuCZZv+MGuQ7BeCxVQ==', 'F9/func+b64/9');
is( f9_b64u('AES','1234567890123456',"test\0test\0test\n"), 'n6SHbuCZZv-MGuQ7BeCxVQ', 'F9/func+b64u/9');
is( unpack('H*', Crypt::Mac::F9->new('AES','12345678901234561234567890123456')->add("test\0test\0test\n")->mac), '6934865f133c0092e4941b45cca38c5f', 'F9/oo+raw/10');
is( Crypt::Mac::F9->new('AES','12345678901234561234567890123456')->add("test\0test\0test\n")->hexmac, '6934865f133c0092e4941b45cca38c5f', 'F9/oo+hex/10');
is( unpack('H*', f9('AES','12345678901234561234567890123456',"test\0test\0test\n")), '6934865f133c0092e4941b45cca38c5f', 'F9/func+raw/10');
is( f9_hex('AES','12345678901234561234567890123456',"test\0test\0test\n"), '6934865f133c0092e4941b45cca38c5f', 'F9/func+hex/10');
is( f9_b64('AES','12345678901234561234567890123456',"test\0test\0test\n"), 'aTSGXxM8AJLklBtFzKOMXw==', 'F9/func+b64/10');
is( f9_b64u('AES','12345678901234561234567890123456',"test\0test\0test\n"), 'aTSGXxM8AJLklBtFzKOMXw', 'F9/func+b64u/10');
is( unpack('H*', Crypt::Mac::F9->new('Blowfish','1234567890123456')->add("test\0test\0test\n")->mac), 'fa83d84023c43a81', 'F9/oo+raw/11');
is( Crypt::Mac::F9->new('Blowfish','1234567890123456')->add("test\0test\0test\n")->hexmac, 'fa83d84023c43a81', 'F9/oo+hex/11');
is( unpack('H*', f9('Blowfish','1234567890123456',"test\0test\0test\n")), 'fa83d84023c43a81', 'F9/func+raw/11');
is( f9_hex('Blowfish','1234567890123456',"test\0test\0test\n"), 'fa83d84023c43a81', 'F9/func+hex/11');
is( f9_b64('Blowfish','1234567890123456',"test\0test\0test\n"), '+oPYQCPEOoE=', 'F9/func+b64/11');
is( f9_b64u('Blowfish','1234567890123456',"test\0test\0test\n"), '-oPYQCPEOoE', 'F9/func+b64u/11');
is( unpack('H*', Crypt::Mac::F9->new('Blowfish','12345678901234561234567890123456')->add("test\0test\0test\n")->mac), 'fa83d84023c43a81', 'F9/oo+raw/12');
is( Crypt::Mac::F9->new('Blowfish','12345678901234561234567890123456')->add("test\0test\0test\n")->hexmac, 'fa83d84023c43a81', 'F9/oo+hex/12');
is( unpack('H*', f9('Blowfish','12345678901234561234567890123456',"test\0test\0test\n")), 'fa83d84023c43a81', 'F9/func+raw/12');
is( f9_hex('Blowfish','12345678901234561234567890123456',"test\0test\0test\n"), 'fa83d84023c43a81', 'F9/func+hex/12');
is( f9_b64('Blowfish','12345678901234561234567890123456',"test\0test\0test\n"), '+oPYQCPEOoE=', 'F9/func+b64/12');
is( f9_b64u('Blowfish','12345678901234561234567890123456',"test\0test\0test\n"), '-oPYQCPEOoE', 'F9/func+b64u/12');
2018-03-22 15:54:03 +01:00
is( unpack('H*', Crypt::Mac::F9->new('AES', '1234567890123456')->add("A","A","A")->mac), 'a30e9e0ee8cd9d7401f9a9967e82b5a1', 'F9/oo+raw/tripple_A');
is( unpack('H*', Crypt::Mac::F9->new('AES', '1234567890123456')->add("A")->add("A")->add("A")->mac), 'a30e9e0ee8cd9d7401f9a9967e82b5a1', 'F9/oo3+raw/tripple_A');
is( Crypt::Mac::F9->new('AES', '1234567890123456')->add("A","A","A")->hexmac, 'a30e9e0ee8cd9d7401f9a9967e82b5a1', 'F9/oo+hex/tripple_A');
is( Crypt::Mac::F9->new('AES', '1234567890123456')->add("A")->add("A")->add("A")->hexmac, 'a30e9e0ee8cd9d7401f9a9967e82b5a1', 'F9/oo3+hex/tripple_A');
is( unpack('H*', f9('AES', '1234567890123456',"A","A","A")), 'a30e9e0ee8cd9d7401f9a9967e82b5a1', 'F9/func+raw/tripple_A');
is( f9_hex ('AES', '1234567890123456',"A","A","A"), 'a30e9e0ee8cd9d7401f9a9967e82b5a1', 'F9/func+hex/tripple_A');
is( f9_b64 ('AES', '1234567890123456',"A","A","A"), 'ow6eDujNnXQB+amWfoK1oQ==', 'F9/func+b64/tripple_A');
is( f9_b64u('AES', '1234567890123456',"A","A","A"), 'ow6eDujNnXQB-amWfoK1oQ', 'F9/func+b64u/tripple_A');