ó Ű_e[c@`s˜ddlmZmZmZddlmZddlmZm Z ddl m Z e j ƒZ e jƒZe jƒZe jƒZd„Zd„ZdS(i(tabsolute_importtdivisiontprint_function(t exceptions(tffitlib(tensurecC`sËt|ƒtkr$tjdƒ‚nt|ƒtkrHtjdƒ‚ndt|}tjdt|ƒƒ}tj ||t|ƒ||ƒ}t |dkddtj ƒtj |t|ƒƒ}|t S(sĆ Encrypts and returns the message ``message`` with the secret ``key`` and the nonce ``nonce``. :param message: bytes :param nonce: bytes :param key: bytes :rtype: bytes s Invalid keys Invalid noncetsunsigned char[]isEncryption failedtraising(tlentcrypto_secretbox_KEYBYTEStexct ValueErrortcrypto_secretbox_NONCEBYTEStcrypto_secretbox_ZEROBYTESRtnewRtcrypto_secretboxRt CryptoErrortbuffertcrypto_secretbox_BOXZEROBYTES(tmessagetnoncetkeytpaddedt ciphertexttres((s@/tmp/pip-install-KP2Jbq/pynacl/nacl/bindings/crypto_secretbox.pyRs !cC`sËt|ƒtkr$tjdƒ‚nt|ƒtkrHtjdƒ‚ndt|}tjdt|ƒƒ}tj ||t|ƒ||ƒ}t |dkddtj ƒtj |t|ƒƒ}|t S(sŐ Decrypt and returns the encrypted message ``ciphertext`` with the secret ``key`` and the nonce ``nonce``. :param ciphertext: bytes :param nonce: bytes :param key: bytes :rtype: bytes s Invalid keys Invalid nonceRsunsigned char[]is1Decryption failed. Ciphertext failed verificationR(R R R R R RRRRtcrypto_secretbox_openRRRR(RRRRt plaintextR((s@/tmp/pip-install-KP2Jbq/pynacl/nacl/bindings/crypto_secretbox.pyR6s  N(t __future__RRRtnaclRR t nacl._sodiumRRtnacl.exceptionsRtcrypto_secretbox_keybytesR tcrypto_secretbox_noncebytesR tcrypto_secretbox_zerobytesRtcrypto_secretbox_boxzerobytesRRR(((s@/tmp/pip-install-KP2Jbq/pynacl/nacl/bindings/crypto_secretbox.pyts