日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

术中导航_密码术中的计数器(CTR)模式

發(fā)布時間:2025/3/11 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 术中导航_密码术中的计数器(CTR)模式 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

術(shù)中導航

The Counter Mode or CTR is a simple counter based block cipher implementation in cryptography. Each or every time a counter initiated value is encrypted and given as input to XOR with plaintext or original text which results in ciphertext block. The CTR mode is independent of feedback use and thus can be implemented in parallel in this mode. It generates the next keystream block by encrypting successive values as named as "counter". This counter can be any purpose or function which generates a sequence that is guaranteed not to call for a long time, although an actual increment-by-one counter is the simplest or easiest and most popular or famous. When utilization of the easiest deterministic input function or work used to be promoted or secret or controversial; attacker argued that "deliberately reveal a cryptosystem to a known systematic input represents an unnecessary or unused risk."

計數(shù)器模式或CTR是密碼術(shù)中基于計數(shù)器的簡單的塊密碼實現(xiàn)。 每次或每次對計數(shù)器的初始值進行加密,并以純文本或原始文本作為XOR的輸入時,都會產(chǎn)生密文塊。 CTR模式與反饋的使用無關(guān),因此可以在此模式下并行實現(xiàn)。 它通過加密名為“ counter”的連續(xù)值來生成下一個密鑰流塊。 該計數(shù)器可以是生成序列的任何目的或功能,該序列可以保證長時間不調(diào)用,盡管實際的逐一遞增計數(shù)器是最簡單,最簡單,最受歡迎或最受歡迎的。 當使用最簡單的確定性輸入功能或以前曾被宣傳,秘密或有爭議的工作時; 攻擊者認為“故意向已知的系統(tǒng)輸入泄露密碼系統(tǒng)表示不必要或未使用的風險”。

Its simple implementation is shown below as:

它的簡單實現(xiàn)如下所示:



Image source: https://www.geeksforgeeks.org/block-cipher-modes-of-operation/

圖片來源:https://www.geeksforgeeks.org/block-cipher-modes-of-operation/

We can be considered as a counter-based version of CFB mode without the feedback in this cryptography. In this mode, both the sender and receiver need to get access to a reliable counter, which finds out a new shared value each time a ciphertext block is exchanged or changes the value which is shared. This shared counter is not necessarily a secret value, but the challenge is that both sides must keep the counter synchronized at a time when both are active.

沒有這種密碼學的反饋,我們可以被視為CFB模式的基于計數(shù)器的版本。 在這種模式下,發(fā)送方和接收方都需要訪問可靠的計數(shù)器,每次交換密文塊或更改共享的值時,該計數(shù)器都會找到新的共享值。 該共享計數(shù)器不一定是一個秘密值,但是挑戰(zhàn)在于,當雙方都處于活動狀態(tài)時,雙方都必須保持計數(shù)器同步。

操作方式 (Operation)

Both encryption and decryption in CTR mode are depicted in the following illustration or steps. Steps in operation are,

下圖或步驟描述了CTR模式下的加密和解密。 操作步驟如下:

  • Firstly, load the initial counter value in the top register is the same for both the sender and the receiver in this mode. It plays the same role as the IV in CFB (and CBC) mode similar way.

    首先,在此模式下,對于發(fā)送方和接收方,將初始計數(shù)器值加載到頂部寄存器中是相同的。 它在CFB (和CBC )模式下的作用與IV相似。

  • Then, encrypt the contents of the counter with the key and place the result in the bottom register in this mode.

    然后,用該密鑰加密計數(shù)器的內(nèi)容,并將結(jié)果放入此模式的底部寄存器中。

  • Then, take the first plaintext or original text block P1 and XOR this to the contents of the bottom register. The result of this is C1 as ciphertext. Send C1 as ciphertext to the receiver and update the counter in this mode. The counter update replaces the ciphertext feedback in CFB mode like no feedback required.

    然后,將第一個純文本或原始文本塊P1與其進行“異或”到底部寄存器的內(nèi)容中。 其結(jié)果是C1作為密文。 將C1作為密文發(fā)送到接收器,并在此模式下更新計數(shù)器。 計數(shù)器更新將替換CFB模式下的密文反饋,就像不需要反饋一樣。

  • Continue in this manner until the last plaintext block has been encrypted.

    以這種方式繼續(xù),直到最后一個明文塊已被加密。

  • Thus, decryption is the reverse process. This ciphertext block is XORed with the output of encrypted contents of the counter value of shared. After decryption of each ciphertext, the block counter is updated as in case of encryption in the cryptography.

    因此,解密是相反的過程。 該密文塊與共享計數(shù)器值的加密內(nèi)容的輸出進行異或。 在解密每個密文之后,與在加密中加密的情況一樣,更新塊計數(shù)器。

計數(shù)器模式分析 (Analysis of Counter Mode)

  • It does not have message dependency and hence a ciphertext block does not depend on the previous plaintext or original text blocks.

    它不具有消息依賴性,因此密文塊不依賴于先前的明文或原始文本塊。

  • Similar to CFB mode, CTR mode does not involve the decryption process of the block cipher in that way. This is because the CTR mode is using the block cipher to generate a key-stream, which is encrypted using the XOR function in cryptography. In other words, CTR mode also converts a block cipher to a stream cipher in cryptography.

    與CFB模式類似,CTR模式不以這種方式涉及分組密碼的解密過程。 這是因為CTR模式使用分組密碼生成密鑰流,該密鑰流使用密碼學中的XOR函數(shù)進行了加密。 換句話說,CTR模式還將密碼學中的塊密碼轉(zhuǎn)換為流密碼。

優(yōu)點 (Advantages)

  • Wherever CTR mode has mostly all benefits of CFB mode. Just beside, it does not propagate the error of transmission at all in this mode.

    在任何地方,CTR模式都具有CFB模式的所有優(yōu)勢。 緊挨著,在這種模式下它根本不會傳播傳輸錯誤。

缺點 (Disadvantages)

  • The main disadvantage of CTR mode is that it requires a synchronous counter at the sender and receiver in this mode. Decreases of synchronization lead to the incorrect recovery of plaintext or original text.

    CTR模式的主要缺點在于,在此模式下,發(fā)送方和接收方都需要一個同步計數(shù)器。 同步減少會導致不正確地恢復(fù)純文本或原始文本。

翻譯自: https://www.includehelp.com/cryptography/counter-ctr-mode-in-cryptography.aspx

術(shù)中導航

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結(jié)

以上是生活随笔為你收集整理的术中导航_密码术中的计数器(CTR)模式的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。