avatar
xor cipher面试题求解# JobHunting - 待字闺中
y*m
1
要求写一个xor cipher的utility。
要求摘要:“Create a utility that will perform a simple XOR cryptographic
transform on a given set of data. The encryption key will be provided by the
binary data in an arbitrarily-sized external file. The size of the key in
bytes will dictate the "block size." The plaintext data will be given on
stdin, where the utility will then break it into block-sized sections, XOR
it against the key, and write the cypher text to stdout. After each block is
processed, the key should be rotated to the left by one bit to make a new
key. This means that the key will repeat every N blocks, where N is the
number of bits in the key. The plaintext data need not be a multiple of the
block size in length, nor should it be assumed to be ASCII or Unicode text.
It is also valid for the plaintext to be extremely large, far exceeding the
available memory+swap space for the system.
In addition to correctly performing the transform, the utility should be
able to take advantage of multi-core or multi-processor machines by
implementing a multi-threading scheme that processes multiple blocks of
plaintext in parallel.“
问题:
1。如果plaintext的大小(byte)不是keyfile大小的整数倍,怎么进行xor,需要把
plaintext填充成整数倍?
2。怎么让utility能进行多线程运算?这个问题已经超过我的背景知识了。。。
要求用C、C++,各位有什么想法尽量提,谢谢。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。