qcode
  • 创作工场专业版,一问多答!更智能、更完整、更原创
  • 这是一个超强内容创作平台,它会写文章、做设计、绘图、敲代码,有问必答!
🔥点击使用-免登录深度版🔥

用go实现cfb1算法

时间2023-04-16 14:16:37 提问来自 四川省成都市 的网友 分类创作 浏览335
```go package cfb1 // CFB1 implements the Cipher Feedback Mode 1 algorithm as defined in NIST SP 800-38A. // It takes a block cipher and uses it to encrypt a stream of data. type CFB1 struct { b BlockCipher // The underlying block cipher used for encryption/decryption. block []byte // The current encrypted block. Used as an intermediate state between calls to Encrypt/Decrypt. out []byte // The output buffer containing the encrypted/decrypted data. outUsed int // How many bytes of out have been used so far? // iv is the initialization vector for a new stream of data being encrypted/decrypted. It must be at least as long as b's block size (b.BlockSize()). iv []byte // feedback is how many bits from each block are fed back into the next encryption operation (and thus how much output is produced per call). Must be between 1 and b's block size (inclusive). If 0, defaults to b's block size (the full block). feedback int // firstBlock indicates if this is the first call to Encrypt or Decrypt with this instance of CFB1, in which case special handling must be done on the initial IV before continuing with normal operation. firstBlock bool }

不满意?免费深度重写!

免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。

上一篇 定义一个MONKEY类继承ANIMAL 下一篇 建设教育强国的青年力 量