Apply slightly modified version of patch from #162
This commit is contained in:
parent
965d00dee9
commit
565eff8274
|
@ -33,17 +33,13 @@ from paramiko.ssh_exception import SSHException, ProxyCommandFailure
|
||||||
from paramiko.message import Message
|
from paramiko.message import Message
|
||||||
|
|
||||||
|
|
||||||
got_r_hmac = False
|
|
||||||
try:
|
try:
|
||||||
import r_hmac
|
from r_hmac import HMAC
|
||||||
got_r_hmac = True
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
from Crypto.Hash.HMAC import HMAC
|
||||||
|
|
||||||
def compute_hmac(key, message, digest_class):
|
def compute_hmac(key, message, digest_class):
|
||||||
if got_r_hmac:
|
return HMAC(key, message, digest_class).digest()
|
||||||
return r_hmac.HMAC(key, message, digest_class).digest()
|
|
||||||
from Crypto.Hash import HMAC
|
|
||||||
return HMAC.HMAC(key, message, digest_class).digest()
|
|
||||||
|
|
||||||
|
|
||||||
class NeedRekeyException (Exception):
|
class NeedRekeyException (Exception):
|
||||||
|
|
Loading…
Reference in New Issue