ofb模式
This is an output feedback (OFB) mode is similar in structure to that of CFB in Cryptography. It is the output of the encryption function that is fed back to the shift register in OFB in the cryptography, whereas in CFB in the mode of blocks, the ciphertext unit is fed back to the shift register in the block. The other difference is that the OFB mode operates on full blocks of plaintext or original text and ciphertext, not on an s-bit subset of character. Encryption can be expressed as,
這是一種輸出反饋(OFB)模式 ,其結構與密碼學中的CFB相似。 加密功能的輸出被反饋到密碼學中的OFB中的移位寄存器,而在CFB中,在塊模式下,密文單元被反饋到該塊中的移位寄存器。 另一個區別是,OFB模式對純文本或原始文本和密文的完整塊進行操作,而不對字符的s位子集進行操作。 加密可以表示為
Cj = Pj ? E(K, [Cj - i ? Pj - 1])
By manage the terms, we can demonstrate that decryption works as we like,
通過管理這些條款,我們可以證明解密可以按需工作,
Pj = Cj ? E(K, [Cj - 1 ? Pj - 1])
運作方式 (Operations)
Let the size of a block of the character be b. If the last block of plaintext or original text contains u bits (indicated by *), with u 6 b, the most significant u bits of the last output block ON are used for the XOR operation; the remaining b -u bits of the last output block are discarded in the cryptography.
令字符塊的大小為b。 如果明文或原始文本的最后一個塊包含u位(用*表示),則u 6為b,則將最后一個輸出塊ON的最高有效u位用于XOR操作;否則,為0。 最后輸出塊的其余b -u位在加密中被丟棄。
Like as with CBC and CFB, the OFB mode requires an initialization vector in the system. In the case of OFB, the IV must be a nonce; that is, the IV must be unique to each execution of the encryption operation in the cryptography. The reason for this is that the sequence of encryption output blocks of the character, Oi, depends only on the key and the IV and does not depend on the plaintext or original text. Therefore, for a given key and IV, the stream of output bits used to XOR with the stream of plaintext or original text bits is fixed. If two different messages had an identical block of plaintext or original text in an identical position, then an attacker would be able to determine what portion of the Oi stream in the cryptography.
像CBC和CFB一樣,OFB模式需要系統中的初始化向量。 對于OFB,IV必須是隨機數; 也就是說,IV對于密碼術中加密操作的每次執行必須是唯一的。 這樣做的原因是,字符Oi的加密輸出塊的順序僅取決于密鑰和IV,而不取決于明文或原始文本。 因此,對于給定的密鑰和IV,用于與明文或原始文本位流進行XOR的輸出位流是固定的。 如果兩個不同的消息在相同位置具有相同的純文本或原始文本塊,則攻擊者將能夠確定密碼術中Oi流的哪一部分。
Image source: https://www.brainkart.com/article/Output-Feedback-Mode_8418/
圖片來源:https://www.brainkart.com/article/Output-Feedback-Mode_8418/
Observe that complementing a bit in the ciphertext complements the corresponding bit in the recovered plaintext or original text. Thus, controlled changes to the recovered plaintext can be made. There was the mode of operation may make it possible for an opponent, by making the necessary changes to the checksum portion of the message as well as to the data portion, to alter the ciphertext as work with keys in such a way that it is not detected by an error-correcting code in the cryptography.
請注意,對密文進行補碼可以對恢復的明文或原始文本中的對應位進行補碼。 因此,可以對恢復的明文進行受控更改。 通過對消息的校驗和部分以及數據部分進行必要的更改,操作模式可能使對手有可能更改密文,使其與密鑰一起使用,而不會由加密中的錯誤糾正代碼檢測到。
This is an OFB has the structure of a typical stream cipher, because the cipher generates a stream of bits as a function of initial value and a cryptography key, and that stream of bits is XORed with the plaintext bits or original text. The generated stream that is XORed with the plaintext or original text is itself independent of the plaintext or original text; this is highlighted by dashed boxes. One distinction from the stream ciphers is that OFB encrypts plaintext a full block at a time, where typically a block is 64 or 128 bits of the character. Many stream ciphers encrypt one byte at a time in this mode of operation.
這是一種具有典型流密碼結構的OFB,因為該密碼會根據初始值和加密密鑰生成位流,并且該位流與明文位或原始文本進行異或。 與純文本或原始文本進行異或的生成流本身獨立于純文本或原始文本; 這由虛線框突出顯示。 與流密碼的區別是OFB一次將整個塊加密明文,其中通常一個塊是字符的64或128位。 在這種操作模式下,許多流密碼一次加密一個字節。
優點 (Advantages)
The main advantage of the OFB method is that bit errors in transmission do not propagate in the encryption.
OFB方法的主要優點是傳輸中的誤碼不會在加密中傳播。
For example, if as a bit error occurs in C1 as ciphertext, only the recovered value of P1 as plaintext is affected; subsequent plaintext units are not corrupted. With CFB, C1 as ciphertext also serves as input to the shift register and therefore causes additional corruption downstream in this mode.
例如 ,如果在C1中作為密文發生位錯誤,則僅影響P1作為明文的恢復值; 隨后的明文單元未損壞。 使用CFB時,C1作為密文還用作移位寄存器的輸入,因此在此模式下會導致下游的其他損壞。
缺點 (Disadvantages)
The disadvantage of OFB is that it is more vulnerable to a message stream modification attack than is CFB in the modes of operation.
OFB的缺點是,與CFB相比,它在操作模式下更容易受到消息流修改攻擊。
翻譯自: https://www.includehelp.com/cryptography/output-feedback-mode-ofb-in-cryptography.aspx
ofb模式