pssht
latest
SSH server library written in PHP
Main Page
Classes
Files
File List
Base96.php
1
<?php
2
3
/*
4
* This file is part of pssht.
5
*
6
* (c) François Poirotte <clicky@erebot.net>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace
fpoirotte\Pssht\MAC
;
13
14
use
fpoirotte\Pssht\MAC\MACInterface
;
15
use
fpoirotte\Pssht\Algorithms\AvailabilityInterface
;
16
use
fpoirotte\Pssht\MAC\Base96Interface
;
17
22
abstract
class
Base96
implements
23
MACInterface
,
24
AvailabilityInterface
,
25
Base96Interface
26
{
28
protected
$subhash
;
29
30
final
public
function
__construct
($key)
31
{
32
$cls = static::getBaseClass();
33
$this->subhash =
new
$cls($key);
34
}
35
36
public
static
function
getName
()
37
{
38
$cls = static::getBaseClass();
39
return
$cls::getName() .
'-96'
;
40
}
41
42
final
public
function
compute
($seqno, $data)
43
{
44
return
substr(
45
$this->subhash->compute($seqno, $data),
46
0,
47
$this->
getSize
()
48
);
49
}
50
51
final
public
static
function
getKeySize
()
52
{
53
$cls = static::getBaseClass();
54
return
$cls::getKeySize();
55
}
56
57
final
public
static
function
getSize
()
58
{
59
return
96 >> 3;
60
}
61
62
final
public
static
function
isAvailable
()
63
{
64
$cls = static::getBaseClass();
65
if
($cls instanceof
AvailabilityInterface
) {
66
return
$cls::isAvailable();
67
}
68
return
true
;
69
}
70
}
fpoirotte\Pssht\MAC\Base96\getKeySize
static getKeySize()
Definition:
Base96.php:51
Base96Interface
fpoirotte\Pssht\MAC\Base96Interface
Definition:
Base96Interface.php:18
fpoirotte\Pssht\MAC\Base96\__construct
__construct($key)
Definition:
Base96.php:30
fpoirotte\Pssht\MAC\Base96\$subhash
$subhash
Subhash performing the real MAC operation.
Definition:
Base96.php:28
fpoirotte\Pssht\MAC\Base96\getSize
static getSize()
Definition:
Base96.php:57
fpoirotte\Pssht\MAC\Base96\isAvailable
static isAvailable()
Definition:
Base96.php:62
fpoirotte\Pssht\MAC\Base96\compute
compute($seqno, $data)
Definition:
Base96.php:42
fpoirotte\Pssht\MAC
Definition:
Base.php:12
AvailabilityInterface
MACInterface
fpoirotte\Pssht\MAC\MACInterface
Definition:
MACInterface.php:17
fpoirotte\Pssht\MAC\Base96
Definition:
Base96.php:22
fpoirotte\Pssht\Algorithms\AvailabilityInterface
Definition:
AvailabilityInterface.php:18
fpoirotte\Pssht\MAC\Base96\getName
static getName()
Return the name of the algorithm.
Definition:
Base96.php:36
src
MAC
Base96.php
Generated on Tue May 9 2017 12:09:56 for pssht by
1.8.11