Advertisement

python rc4 algorithm implementation

阅读量:

python3 - RC4 算法

max.bai

2019.07

在实际工作过程中所接触的RC4算法,现进行简要记录

RC4算法具备加密与解密过程一致的特性,通过对数据再次进行加密操作即可实现解密效果

代码实现:

复制代码
 # coding: utf-8

    
  
    
 # import base64
    
 import binascii
    
  
    
  
    
 def rc4_crypt(PlainBytes:bytes, KeyBytes:bytes) -> str:
    
     '''[summary]
    
     rc4 crypt
    
     Arguments:
    
     PlainBytes {[bytes]} -- [plain bytes]
    
     KeyBytes {[bytes]} -- [key bytes]
    
     
    
     Returns:
    
     [string] -- [hex string]
    
     '''
    
  
    
     keystreamList = []
    
     cipherList = []
    
  
    
     keyLen = len(

全部评论 (0)

还没有任何评论哟~