# eric7.EricUtilities.crypto.__init__

Package implementing cryptography related functionality.

### Global Attributes

CryptoMarker
Delimiter
EncodeMarker
MainPassword

### Classes

None

### Functions

__getMainPassword | Private module function to get the password from the user.
changeRememberedMain | Module function to change the remembered main password.
dataDecrypt | Module function to decrypt a password.
dataEncrypt | Module function to encrypt a password.
pwConvert | Module function to convert a plaintext password to the encoded form or vice versa.
pwDecode | Module function to decode a password.
pwDecrypt | Module function to decrypt a password.
pwEncode | Module function to encode a password.
pwEncrypt | Module function to encrypt a password.
pwRecode | Module function to re-encode a password.
pwReencrypt | Module function to re-encrypt a password.

## __getMainPassword

__getMainPassword()

Private module function to get the password from the user.

Up

## changeRememberedMain

changeRememberedMain(newPassword)

Module function to change the remembered main password.

newPassword (str)
  new password to be used

Up

## dataDecrypt

dataDecrypt(edata, password, keyLength=32)

Module function to decrypt a password.

edata (str)
  hashed data to decrypt
password (str)
  password to be used for decryption
keyLength (int)
  length of the key to be generated for decryption (16, 24 or 32)

Return:
  decrypted data (bytes) and flag indicating success

Return Type:
  bool

Up

## dataEncrypt

dataEncrypt(data, password, keyLength=32, hashIterations=10000)

Module function to encrypt a password.

data (bytes)
  data to encrypt
password (str)
  password to be used for encryption
keyLength (int)
  length of the key to be generated for encryption (16, 24 or 32)
hashIterations (int)
  number of hashes to be applied to the password for generating the encryption key

Return:
  encrypted data (bytes) and flag indicating success

Return Type:
  bool

Up

## pwConvert

pwConvert(pw, encode=True)

Module function to convert a plaintext password to the encoded form or vice versa.

If there is an error, an empty code is returned for the encode function or the given encoded password for the decode function.

pw (str)
  password to encode
encode (bool)
  flag indicating an encode or decode function

Return:
  encoded or decoded password

Return Type:
  str

Up

## pwDecode

pwDecode(epw)

Module function to decode a password.

epw (str)
  encoded password to decode

Return:
  decoded password

Return Type:
  str

Up

## pwDecrypt

pwDecrypt(epw, mainPW=None)

Module function to decrypt a password.

epw (str)
  hashed password to decrypt
mainPW (str)
  password to be used for decryption

Return:
  decrypted password (string) and flag indicating success

Return Type:
  bool

Up

## pwEncode

pwEncode(pw)

Module function to encode a password.

pw (str)
  password to encode

Return:
  encoded password

Return Type:
  str

Up

## pwEncrypt

pwEncrypt(pw, mainPW=None)

Module function to encrypt a password.

pw (str)
  password to encrypt
mainPW (str)
  password to be used for encryption

Return:
  encrypted password (string) and flag indicating success

Return Type:
  bool

Up

## pwRecode

pwRecode(epw, oldPassword, newPassword)

Module function to re-encode a password.

In case of an error the encoded password is returned unchanged.

epw (str)
  encoded password to re-encode
oldPassword (str)
  password used to encode
newPassword (str)
  new password to be used

Return:
  encoded password

Return Type:
  str

Up

## pwReencrypt

pwReencrypt(epw, oldPassword, newPassword)

Module function to re-encrypt a password.

epw (str)
  hashed password to re-encrypt
oldPassword (str)
  password used to encrypt
newPassword (str)
  new password to be used

Return:
  encrypted password (string) and flag indicating success

Return Type:
  bool

Up