Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/tlslite/tlslite/utils/cryptlib_rc4.py

Issue 211173006: Perform tlslite 0.3.8 -> 0.4.6 renames ahead of time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop the -B Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 """Cryptlib RC4 implementation.""" 1 """Cryptlib RC4 implementation."""
2 2
3 from cryptomath import * 3 from cryptomath import *
4 from RC4 import RC4 4 from rc4 import RC4
5 5
6 if cryptlibpyLoaded: 6 if cryptlibpyLoaded:
7 7
8 def new(key): 8 def new(key):
9 return Cryptlib_RC4(key) 9 return Cryptlib_RC4(key)
10 10
11 class Cryptlib_RC4(RC4): 11 class Cryptlib_RC4(RC4):
12 12
13 def __init__(self, key): 13 def __init__(self, key):
14 RC4.__init__(self, key, "cryptlib") 14 RC4.__init__(self, key, "cryptlib")
15 self.context = cryptlib_py.cryptCreateContext(cryptlib_py.CRYPT_UNUS ED, cryptlib_py.CRYPT_ALGO_RC4) 15 self.context = cryptlib_py.cryptCreateContext(cryptlib_py.CRYPT_UNUS ED, cryptlib_py.CRYPT_ALGO_RC4)
16 cryptlib_py.cryptSetAttribute(self.context, cryptlib_py.CRYPT_CTXINF O_KEYSIZE, len(key)) 16 cryptlib_py.cryptSetAttribute(self.context, cryptlib_py.CRYPT_CTXINF O_KEYSIZE, len(key))
17 cryptlib_py.cryptSetAttributeString(self.context, cryptlib_py.CRYPT_ CTXINFO_KEY, key) 17 cryptlib_py.cryptSetAttributeString(self.context, cryptlib_py.CRYPT_ CTXINFO_KEY, key)
18 18
19 def __del__(self): 19 def __del__(self):
20 cryptlib_py.cryptDestroyContext(self.context) 20 cryptlib_py.cryptDestroyContext(self.context)
21 21
22 def encrypt(self, plaintext): 22 def encrypt(self, plaintext):
23 bytes = stringToBytes(plaintext) 23 bytes = stringToBytes(plaintext)
24 cryptlib_py.cryptEncrypt(self.context, bytes) 24 cryptlib_py.cryptEncrypt(self.context, bytes)
25 return bytesToString(bytes) 25 return bytesToString(bytes)
26 26
27 def decrypt(self, ciphertext): 27 def decrypt(self, ciphertext):
28 return self.encrypt(ciphertext) 28 return self.encrypt(ciphertext)
OLDNEW
« no previous file with comments | « third_party/tlslite/tlslite/utils/cryptlib_aes.py ('k') | third_party/tlslite/tlslite/utils/cryptlib_tripledes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698