From 41e1479213c967677d3353a7cda32e110e805d3d Mon Sep 17 00:00:00 2001 From: cheatfate Date: Fri, 13 Sep 2019 09:52:13 +0300 Subject: [PATCH] Add rust's TwofishCTR support. --- libp2p/crypto/crypto.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libp2p/crypto/crypto.nim b/libp2p/crypto/crypto.nim index c88437a50..9ffdb70fa 100644 --- a/libp2p/crypto/crypto.nim +++ b/libp2p/crypto/crypto.nim @@ -10,10 +10,10 @@ ## This module implements Public Key and Private Key interface for libp2p. import rsa, ecnist, ed25519/ed25519, secp import ../protobuf/minprotobuf, ../vbuffer, ../multihash, ../multicodec -import nimcrypto/[rijndael, blowfish, sha, sha2, hash, hmac, utils] +import nimcrypto/[rijndael, blowfish, twofish, sha, sha2, hash, hmac, utils] # This is workaround for Nim's `import` bug -export rijndael, blowfish, sha, sha2, hash, hmac, utils +export rijndael, blowfish, twofish, sha, sha2, hash, hmac, utils from strutils import split @@ -499,6 +499,9 @@ proc stretchKeys*(cipherType: string, hashType: string, elif cipherType == "AES-256": result.ivsize = aes256.sizeBlock result.keysize = aes256.sizeKey + elif cipherType == "TwofishCTR": + result.ivsize = twofish256.sizeBlock + result.keysize = twofish256.sizeKey elif cipherType == "BLOWFISH": result.ivsize = 8 result.keysize = 32