MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / __crypt

Method __crypt

server/projects/main/util/cipher.py:18–29  ·  view source on GitHub ↗

对单个字母加密,偏移 @param char: {str} 单个字符 @param key: {num} 偏移量 @return: {str} 加密后的字符

(self, char, key)

Source from the content-addressed store, hash-verified

16 """
17
18 def __crypt(self, char, key):
19 """
20 对单个字母加密,偏移
21 @param char: {str} 单个字符
22 @param key: {num} 偏移量
23 @return: {str} 加密后的字符
24 """
25 if not char.isalpha():
26 return char
27 else:
28 base = "A" if char.isupper() else "a"
29 return chr((ord(char) - ord(base) + key) % 26 + ord(base))
30
31 def encrypt(self, char, key):
32 """

Callers 2

encryptMethod · 0.95
decryptMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected