如何使用AES算法加密32位长度的数据?
我有一个以明文为128bits的AES算法的版本,现在我想将此版本更改为32bits。我该怎么做?
当我将数据发送到核心AES时,这是我的代码的一部分,我将128bits发送到加密,并且检查结果是否为真。
apb_write(x“ e2bec16b”,aes_cmd_addr_datain_0);
apb_write(x“ 969f402e”,aes_cmd_addr_datain_1);
apb_write(x“ 117e3de9”,aes_cmd_addr_datain_2);
apb_write(x“ 2a179373”,aes_cmd_addr_datain_3);
x“ 80000005”,aes_cmd_addr_control)
apb_write( ACAB4976“,AES_CMD_ADDR_DATAOUT_0);
apb_write(x“ 46b21981”,aes_cmd_addr_dataout_1);
apb_write(x“ 9b8ee9ce”,aes_cmd_addr_dataout_2);
apb_write(x“ 7d19e912”,aes_cmd_addr_dataout_3);
问题:我如何仅发送32bits并检查后,然后发送32bits并检查....? 我该怎么做?
I have a version of AES algorithm with 128bits in plaintext, now i want to change this version to 32bits in plaintext . How can i do this, please ?
That's part of my code when i send data to core AES, i send 128bits to encrypt and i check if the result is true.
apb_write(x"e2bec16b",AES_CMD_ADDR_DATAIN_0);
apb_write(x"969f402e",AES_CMD_ADDR_DATAIN_1);
apb_write(x"117e3de9",AES_CMD_ADDR_DATAIN_2);
apb_write(x"2a179373",AES_CMD_ADDR_DATAIN_3);
apb_write(x"80000005",AES_CMD_ADDR_CONTROL);
--confige AES with mode (CBC)
apb_write(x"acab4976",AES_CMD_ADDR_DATAOUT_0);
apb_write(x"46b21981",AES_CMD_ADDR_DATAOUT_1);
apb_write(x"9b8ee9ce",AES_CMD_ADDR_DATAOUT_2);
apb_write(x"7d19e912",AES_CMD_ADDR_DATAOUT_3);
The question : how i can send just 32bits and check , after, send 32bits and check ....?
how i can do this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,AES仅针对128位的块定义。
如果您想加密32位的块,则需要对纯文本进行填充(例如0),直到达到128位。然后,如果您想解密它,只需正常解密,然后解密后,将最后一个(或首先取决于您填充的侧面)96(128-32)位。
AES is as far as I know only defined for blocks of 128 bits.
If you want to encrypt blocks of 32 bits, you'd need to pad your plain text (with for example 0's) until you reach 128 bits. Then, if you want to decrypt it, just decrypt it normally and after the decryption chop off the last (or first, depending which side you padded) 96 (128 - 32) bits.