-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathAES192.php
More file actions
72 lines (65 loc) · 2.02 KB
/
AES192.php
File metadata and controls
72 lines (65 loc) · 2.02 KB
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
<?php
/*
* Author: Ryan Gilfether
* URL: http://www.gilfether.com/phpCrypt
* Date: April 3, 2013
* Copyright (C) 2013 Ryan Gilfether
*
* This file is part of phpCrypt
*
* phpCrypt is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
namespace PHP_CRYPT;
require_once(dirname(__FILE__)."/../phpCrypt.php");
require_once(dirname(__FILE__)."/Rijndael128.php");
/**
* Implement Advanced Encryption Standard (AES)
* Both AES-192 and Rijndael-128 operate on 128 bit blocks.
* The only difference is AES-192 uses a 192 bit key, where
* as Rijndael-128 can uses a variable length key.
*
* @author Ryan Gilfether
* @link http://www.gilfether.com/phpcrypt
* @copyright 2013 Ryan Gilfether
*/
class Cipher_AES_192 extends Cipher_Rijndael_128
{
/** @type integer BYTES_BLOCK The size of the block, in bytes */
const BYTES_BLOCK = 16; // 128 bits;
/** @type integer BYTES_KEY The size of the key, in bytes */
const BYTES_KEY = 24; // 192 bits;
/**
* Constructor
* Sets the key used for encryption.
*
* @param string $key string containing the user supplied encryption key
* @return void
*/
public function __construct($key)
{
// Setup AES by calling the second constructor in Rijndael_128
// The block size is set here too, since all AES implementations use 128 bit blocks
parent::__construct1(PHP_Crypt::CIPHER_AES_192, $key, self::BYTES_KEY);
}
/**
* Destructor
*
* @return void
*/
public function __destruct()
{
parent::__destruct();
}
}
?>