package
0.0.0-20241202140915-f5a8bb7a9236
Repository: https://github.com/gdgrc/grutils.git
Documentation: pkg.go.dev
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
this is good===================.
No description provided by the author
No description provided by the author
https://github.com/nanjishidu/gomini/blob/master/gocrypto/padding.go.
No description provided by the author
======================.
No description provided by the author
No description provided by the author
No description provided by the author
utf8字节数组转unicode.
No description provided by the author
unicode字节数组转utf8.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
InArray 查找是否在数组里面.
No description provided by the author
No description provided by the author
No description provided by the author
Marshal 转化为json返回.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.
NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
变种rc4.
No description provided by the author
No description provided by the author
No description provided by the author
TimeChange 转化为标准模式输出.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
# Structs
No description provided by the author
import hashlib
class RC4:
def __init__(self, public_key):
self.public_key = public_key
self.public_key = self.public_key.encode("utf-8")
self.public_key = hashlib.md5(self.public_key).hexdigest()
print(self.public_key)
def encode(self, text):
return self.__docrypt(text)
def decode(self, text):
return self.__docrypt(text)
def __docrypt(self, text):
result = ''
box = list(range(256))
randkey = []
key_lenth = len(self.public_key)
for i in range(255):
randkey.append(ord(self.public_key[i % key_lenth]))
for i in range(255):
j = 0
j = (j + box[i] + randkey[i]) % 256
tmp = box[i]
box[i] = box[j]
box[j] = tmp
for i in range(len(text)):
a = j = 0
a = (a + 1) % 256
j = (j + box[a]) % 256
tmp = box[a]
box[a] = box[j]
box[j] = tmp
result += chr(ord(text[i]) ^ (box[(box[a] + box[j]) % 256]))
return result
class AesRC4Base64(object):
"""
aes+rc4+base64
"""
def __init__(self, key='key for aes333', rc4_key='key for rc4'):
self.key = key
# if we can't get special key for rc4, then we use key
self.rc4 = RC4(rc4_key if rc4_key else self.key)
# we use key utf8 format as the key for aes
self.aes_total_key = hashlib.md5(self.key.encode("utf-8")).hexdigest()
self.aes_iv = self.aes_total_key[16:32].encode('utf-8')
self.aes_key = self.aes_total_key[:16].encode('utf-8')
self.length = 16
self.aes = Aes(self.aes_key, self.aes_iv)
def encode(self, text):
aes_text = b2a_hex(self.aes.encode(text))
ciphertext = self.rc4.encode(aes_text.decode('utf8')).encode('utf8')
return base64.b64encode(ciphertext).decode('utf8')
def decode(self, text):
text = base64.b64decode(text.encode('utf8')).decode('utf8')
text = self.rc4.decode(text)
plain_text = self.aes.decode(a2b_hex(text))
return plain_text
*/.
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author