1 2 3 4 5 6
#!/usr/bin/env perl use Crypt::Ctr; my $aeskey = 'Ready to Have Some Fun'; my $input = 'DzQPUdLS0tKCWf9U6V/UDB3aQEUWCQ=='; my $cipher = new Crypt::Ctr $aeskey, 'Crypt::Rijndael'; print $cipher->decrypt($input) . "\n";
1 2 3 4 5 6 7
#!/usr/bin/env perl use Crypt::Nettle::Cipher; my $aeskey = 'Ready to Have Some Fun'; my $input = 'DzQPUdLS0tKCWf9U6V/UDB3aQEUWCQ=='; my $cipher = Crypt::Nettle::Cipher->new('decrypt', 'aes256', $aeskey, 'ctr'); $ciphertext = $cipher->process($input); print $ciphertext . "\n";
2013-02-04T08:03:14 MuffiSicher, dass du nicht input und key vertauscht hast?
2013-02-04T08:17:17 MuffiAlso vielleicht versteh ich grad auch was nicht, aber was willst du jetzt hören?
QuoteAES mit jeder beliebigen funktionieren sollte, weil irgendeine (kaputte?) php-implementation das auch kann?
Quote32 Zeichen lang ist, womit man schon eher auf 256 Bytes käme, deswegen auch meine Frage vorher.
2013-02-04T08:27:58 GwenDragonWenn du jetzt den Key am Ende mehrfach mit \0 auffüllst, damit er 16, 24 oder 32 Bytes lang ist, klappt es dann?
2013-02-04T13:32:40 GwenDragonIch weiß nicht, ob die PHP-Klassen wirklich fehlerfrei sind und portable Daten produzieren, die mit anderen AES-Bibliotheken wie z. B. mcrypt gelesen werden können.
2013-02-04T13:35:15 murphyDie Erzeugung bzw. Extraktion des Nonce muss also ebenfalls in Perl kompatibel nachgebaut werden.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
if($i % $Nk == 0){ my $temp1 = rotWord(\@temp); my @temp1 = @$temp1; #print Dumper([@temp1]) . "\n"; my $temp2 = subWord(\@temp1); @temp = @$temp2; #print Dumper([@temp]) . "\n"; for (my $t=0; $t<4; $t++){ $temp[$t] ^= $rCon[$i/$Nk][$t];#whats wrong? #Use of uninitialized value in bitwise xor (^) at aes.pl line 279. #print $temp[$t] . "\n"; } }elsif($Nk > 6 && $i%$Nk == 4) { my $temp2 = subWord(\@temp); @temp = @$temp2; } for (my $t=0; $t<4; $t++){ $w[$i][$t] = $w[$i-$Nk][$t] ^ $temp[$t]; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"my" variable $test masks earlier declaration in same scope at
test_verschluesselung.pl line 75 (#1)
(W misc) A "my", "our" or "state" variable has been redeclared in the
current scope or statement, effectively eliminating all access to the
previous instance. This is almost always a typographical error. Note
that the earlier variable will still exist until the end of the scope
or until all closure referents to it are destroyed.
Integer overflow in hexadecimal number at test_verschluesselung.pl line 447 (#2)
(W overflow) The hexadecimal, octal or binary number you have specified
either as a literal or as an argument to hex() or oct() is too big for
your architecture, and has been converted to a floating point number.
On a 32-bit architecture the largest hexadecimal, octal or binary number
representable without overflow is 0xFFFFFFFF, 037777777777, or
0b11111111111111111111111111111111 respectively. Note that Perl
transparently promotes all numbers to a floating point representation
internally--subject to loss of precision errors in subsequent
operations.
Hexadecimal number > 0xffffffff non-portable at test_verschluesselung.pl line
447 (#3)
(W portable) The hexadecimal number you specified is larger than 2**32-1
(4294967295) and therefore non-portable between systems. See
perlport for more on portability concerns.
Integer overflow in hexadecimal number at test_verschluesselung.pl line 559 (#2)
Hexadecimal number > 0xffffffff non-portable at test_verschluesselung.pl line
559 (#3)
Global symbol "@W" requires explicit package name at test_verschluesselung.pl line 93.
Global symbol "@keyback" requires explicit package name at test_verschluesselung.pl line 410.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 411.
Global symbol "@keyback" requires explicit package name at test_verschluesselung.pl line 411.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 412.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 412.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 412.
Global symbol "@key" requires explicit package name at test_verschluesselung.pl line 413.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 413.
Global symbol "$ctrTxt" requires explicit package name at test_verschluesselung.pl line 418.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 419.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 419.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 419.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 420.
Global symbol "$ctrTxt" requires explicit package name at test_verschluesselung.pl line 420.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 420.
Global symbol "@key" requires explicit package name at test_verschluesselung.pl line 426.
Global symbol "$cipherCntr" requires explicit package name at test_verschluesselung.pl line 449.
Global symbol "$cipherCntr" requires explicit package name at test_verschluesselung.pl line 456.
Global symbol "$plaintext" requires explicit package name at test_verschluesselung.pl line 467.
Global symbol "$plaintext" requires explicit package name at test_verschluesselung.pl line 468.
Global symbol "$keyexp" requires explicit package name at test_verschluesselung.pl line 516.
Global symbol "$keyexp" requires explicit package name at test_verschluesselung.pl line 520.
Execution of test_verschluesselung.pl aborted due to compilation errors (#4)
(F) You've said "use strict" or "use strict vars", which indicates
that all variables must either be lexically scoped (using "my" or "state"),
declared beforehand using "our", or explicitly qualified to say
which package the global variable is in (using "::").
Uncaught exception from user code:
Global symbol "@W" requires explicit package name at test_verschluesselung.pl line 93.
Global symbol "@keyback" requires explicit package name at test_verschluesselung.pl line 410.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 411.
Global symbol "@keyback" requires explicit package name at test_verschluesselung.pl line 411.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 412.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 412.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 412.
Global symbol "@key" requires explicit package name at test_verschluesselung.pl line 413.
Global symbol "$key" requires explicit package name at test_verschluesselung.pl line 413.
Global symbol "$ctrTxt" requires explicit package name at test_verschluesselung.pl line 418.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 419.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 419.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 419.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 420.
Global symbol "$ctrTxt" requires explicit package name at test_verschluesselung.pl line 420.
Global symbol "$i" requires explicit package name at test_verschluesselung.pl line 420.
Global symbol "@key" requires explicit package name at test_verschluesselung.pl line 426.
Global symbol "$cipherCntr" requires explicit package name at test_verschluesselung.pl line 449.
Global symbol "$cipherCntr" requires explicit package name at test_verschluesselung.pl line 456.
Global symbol "$plaintext" requires explicit package name at test_verschluesselung.pl line 467.
Global symbol "$plaintext" requires explicit package name at test_verschluesselung.pl line 468.
Global symbol "$keyexp" requires explicit package name at test_verschluesselung.pl line 516.
Global symbol "$keyexp" requires explicit package name at test_verschluesselung.pl line 520.
Execution of test_verschluesselung.pl aborted due to compilation errors.