Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F26077627
D4079.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4079.diff
View Options
diff --git a/github/tests/XHubSignatureConstants.php b/github/tests/XHubSignatureConstants.php
--- a/github/tests/XHubSignatureConstants.php
+++ b/github/tests/XHubSignatureConstants.php
@@ -6,7 +6,12 @@
define('TIGER_PAYLOAD', 'lorem ipsum dolor');
define('TIGER_SIGNATURE', '7081ac97e50ad97e13b2fb9364b9df376c26b920080245ce');
-// Current default algo is sha-1.
+// Current default algo is sha-256. This test uses documentation values.
+define('DEFAULT_256_PAYLOAD', "Hello, World!");
+define('DEFAULT_256_SECRET', "It's a Secret to Everybody");
+define('DEFAULT_256_SIGNATURE', "757107ea0eb2509fc211221cce984b8a37570b6d7586c22c46f4379c8b043e17");
+
+// Legacy default algo is sha-1.
define('DEFAULT_PAYLOAD', file_get_contents(__DIR__ . '/payload.json'));
define('DEFAULT_SIGNATURE', 'ab05a3aef13696b60a60a8064b9fda31a8c77582');
diff --git a/github/tests/XHubSignatureTest.php b/github/tests/XHubSignatureTest.php
--- a/github/tests/XHubSignatureTest.php
+++ b/github/tests/XHubSignatureTest.php
@@ -41,6 +41,19 @@
);
}
+ ///
+ /// Tests for X-Hub-Signature-256 / SHA-256 (T2310)
+ ///
+
+ public function testCompute256 () : void {
+ $instance = new XHubSignature(DEFAULT_256_SECRET, "sha256");
+ $instance->payload = DEFAULT_256_PAYLOAD;
+ $this->assertSame(
+ DEFAULT_256_SIGNATURE,
+ $instance->compute()
+ );
+ }
+
///
/// Test static helper methods
///
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 00:39 (22 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3644768
Default Alt Text
D4079.diff (1 KB)
Attached To
Mode
D4079: Test X-Hub-Signature-256 documentation values
Attached
Detach File
Event Timeline
Log In to Comment