-
-
Notifications
You must be signed in to change notification settings - Fork 15
New default KDF #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New default KDF #83
Conversation
Codecov Report
@@ Coverage Diff @@
## master #83 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 7 7
Lines 162 171 +9
Branches 5 5
=====================================
+ Hits 162 171 +9
Continue to review full report at Codecov.
|
Can you add some test cases? |
@kigawas it tests against your Python backend, I cannot fix it. |
@kigawas did you test it with JS one? |
I'll test it later today |
def test_hdkf(self):
k1 = PrivateKey(secret=bytes([2]))
self.assertEqual(k1.to_int(), 2)
k2 = PrivateKey(secret=bytes([3]))
self.assertEqual(k2.to_int(), 3)
self.assertEqual(
encapsulate(k1, k2.public_key), decapsulate(k1.public_key, k2)
)
self.assertEqual(
encapsulate(k1, k2.public_key).hex(),
'6f982d63e8590c9d9b5b4c1959ff80315d772edd8f60287c9361d548d5200f82'
) |
@kigawas if you were surprised with encapsulate/decapsulate syntax, I took it from google's tink, because we need same public key. KEM is just key encapsulation mechanism. ECIES is basically KEM+DEM (data encapsulation mechanism). |
@kigawas let me know when you will have deployed new Python backend at Heroku. I want to test Go version against it. |
@L11r |
@kigawas if so, JS tests still fail 🤔 |
I'll fix js version, wait a sec |
Looks ok for now. |
@kigawas yeah, already got it. Will fix Go version soon. |
derived = HKDF(b'secret', 32, b'', SHA256).hex()
self.assertEqual(
derived,
"2f34e5ff91ec85d53ca9b543683174d0cf550b60d5f52b24c97b386cfcf6cbbf"
) You can use this to check hkdf |
@kigawas yeah, already done. |
HKDF-HMAC-SHA256 instead of just SHA256