Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

47 righe
2.1 KiB

  1. """
  2. passlib.utils.des - DEPRECATED LOCATION, WILL BE REMOVED IN 2.0
  3. This has been moved to :mod:`passlib.crypto.des`.
  4. """
  5. #=============================================================================
  6. # import from new location
  7. #=============================================================================
  8. from warnings import warn
  9. warn("the 'passlib.utils.des' module has been relocated to 'passlib.crypto.des' "
  10. "as of passlib 1.7, and the old location will be removed in passlib 2.0",
  11. DeprecationWarning)
  12. #=============================================================================
  13. # relocated functions
  14. #=============================================================================
  15. from passlib.utils.decor import deprecated_function
  16. from passlib.crypto.des import expand_des_key, des_encrypt_block, des_encrypt_int_block
  17. expand_des_key = deprecated_function(deprecated="1.7", removed="1.8",
  18. replacement="passlib.crypto.des.expand_des_key")(expand_des_key)
  19. des_encrypt_block = deprecated_function(deprecated="1.7", removed="1.8",
  20. replacement="passlib.crypto.des.des_encrypt_block")(des_encrypt_block)
  21. des_encrypt_int_block = deprecated_function(deprecated="1.7", removed="1.8",
  22. replacement="passlib.crypto.des.des_encrypt_int_block")(des_encrypt_int_block)
  23. #=============================================================================
  24. # deprecated functions -- not carried over to passlib.crypto.des
  25. #=============================================================================
  26. import struct
  27. _unpack_uint64 = struct.Struct(">Q").unpack
  28. @deprecated_function(deprecated="1.6", removed="1.8",
  29. replacement="passlib.crypto.des.des_encrypt_int_block()")
  30. def mdes_encrypt_int_block(key, input, salt=0, rounds=1): # pragma: no cover -- deprecated & unused
  31. if isinstance(key, bytes):
  32. if len(key) == 7:
  33. key = expand_des_key(key)
  34. key = _unpack_uint64(key)[0]
  35. return des_encrypt_int_block(key, input, salt, rounds)
  36. #=============================================================================
  37. # eof
  38. #=============================================================================