Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3295392
PhabricatorHMACTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorHMACTestCase.php
View Options
<?php
final
class
PhabricatorHMACTestCase
extends
PhabricatorTestCase
{
protected
function
getPhabricatorTestCaseConfiguration
(
)
{
return
array
(
self
::
PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES
=>
true
,
)
;
}
public
function
testHMACKeyGeneration
(
)
{
$input
=
'quack'
;
$hash_1
=
PhabricatorHash
::
digestWithNamedKey
(
$input
,
'test'
)
;
$hash_2
=
PhabricatorHash
::
digestWithNamedKey
(
$input
,
'test'
)
;
$this
->
assertEqual
(
$hash_1
,
$hash_2
)
;
}
public
function
testSHA256Hashing
(
)
{
$input
=
'quack'
;
$key
=
'duck'
;
$expect
=
'5274473dc34fc61bd7a6a5ff258e6505'
.
'4b26644fb7a272d74f276ab677361b9a'
;
$hash
=
PhabricatorHash
::
digestHMACSHA256
(
$input
,
$key
)
;
$this
->
assertEqual
(
$expect
,
$hash
)
;
$input
=
'The quick brown fox jumps over the lazy dog'
;
$key
=
'key'
;
$expect
=
'f7bc83f430538424b13298e6aa6fb143'
.
'ef4d59a14946175997479dbc2d1a3cd8'
;
$hash
=
PhabricatorHash
::
digestHMACSHA256
(
$input
,
$key
)
;
$this
->
assertEqual
(
$expect
,
$hash
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Mar 27, 01:58 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1195545
Default Alt Text
PhabricatorHMACTestCase.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment