維吉尼亞密碼和一次性密碼本_密碼學中的一次性密碼

維吉尼亞密碼和一次性密碼本

The One-time Pad cipher is almost similar to the Vernam cipher, as, like the vernam cipher, this cipher technique also encrypts the plain text by working on the binary level of the text. The only difference between the two is that the length of the key in the Vernam Cipher must be less than or equal to the length of the plain text, whereas, in One-time pad Cipher, the length of the key must be equal to that of the Plain text. It cannot be less than that.

一次性Pad密碼幾乎與Vernam密碼相似,因為像vernam密碼一樣 ,該密碼技術還通過在文本的二進制級別上進行工作來對純文本進行加密。 兩者之間的唯一區別是,Vernam密碼中的密鑰長度必須小于或等于純文本的長度,而在一次性填充密碼中 ,密鑰的長度必須等于純文本的長度。純文本。 它不能少于那個。

Now, talking about its characteristics and details, One-time pad cipher is a cipher in which we consider both the plain text and the key string in its binary form.

現在,在談論其特征和細節時, 一次性填充密碼是一種密碼,在該密碼中,我們同時考慮了純文本和二進制形式的密鑰字符串。

The following key points can be drawn for the One Time Pad cipher,

可以為One Time Pad密碼得出以下要點,

  • The key chosen here is a string whose length must be equal to the length of the plain text.

    此處選擇的鍵是一個字符串,其長度必須等于純文本的長度。

  • The key can be either in string form or directly in binary form also.

    密鑰可以是字符串形式,也可以是直接二進制形式。

  • It is a type of symmetric-key cryptography.

    它是一種對稱密鑰密碼術 。

  • It is a type of poly-alphabetic cipher, being a part of the substitution cipher.

    它是多字母密碼的一種,是替代密碼的一部分。

加密過程 (Encryption Process)

  • Here, firstly, we convert both our plain text and the key string into its binary form.

    在這里,首先,我們將純文本和密鑰字符串都轉換為二進制格式。

  • Perform XOR operation between the elements of the plain text with the respective elements of the ley string which hold the same positions.

    在純文本的元素與ley字符串的各個元素保持相同位置之間執行XOR操作。

  • Therefore, the encryption on the plain text to convert it into ciphertext is performed as follows,

    因此,對純文本進行加密以將其轉換為密文的過程如下:

        E (Pi , Ki) =  Pi  (XOR)  Ki
    
    

解密過程 (Decryption Process)

The process of decrypting the ciphertext to convert it back into plain text is performed in the same way as the encryption process. Therefore, the formula for decryption of the text under Vernam cipher is as follows,

解密密文以將其轉換回純文本的過程以與加密過程相同的方式執行。 因此,在Vernam密碼下解密文本的公式如下:

    D (Ci , Ki) =  Ci (XOR) Ki

示例問題 (Example Problem)

    Given Plain text: IF 
Key: 1101011 0101111

Convert the given plain text into cipher text...

將給定的純文本轉換為密文...

Solution:

解:

  • Convert the given plain text into its binary form,

    將給定的純文本轉換為其二進制形式,

        1001001 1000110
    
    
  • Check whether the length of the key if equal to that of the plain text,

    檢查密鑰的長度是否等于純文本的長度,

        1 0 0 1 0 0 1   1 0 0 0 1 1 0
    1 1 0 1 0 1 1   0 1 0 1 1 1 1
    
    
  • Tape the elements of the plain text with the respective elements of the ley string which hold the same positions.

    將純文本的元素與ley字符串的各個元素保持相同的位置。

    Example for position 1, we encrypt as follows,

    位置1的示例,我們加密如下,

        E( 1, 1 )   =  1  XOR  1
    = 0
    
    
  • Similarly, after performing the encryption for the whole plain text, we get the following results,

    同樣,在對整個純文本進行加密之后,我們得到以下結果,

        1 0 0 1 0 0 1   1 0 0 0 1 1 0
    1 1 0 1 0 1 1   0 1 0 1 1 1 1 
    ------------------------------
    0 1 0 0 0 1 0   1 1 0 1 0 0 1
    
    

Note: You can cross-check your answer by applying the decryption process over the ciphertext, and if it comes back to be the same as the plain text, then it means that our answer is correct.

注意:您可以通過對密文應用解密過程來交叉檢查您的答案,如果它與純文本相同,則表明我們的答案是正確的。

翻譯自: https://www.includehelp.com/cryptography/one-time-pad-cipher.aspx

維吉尼亞密碼和一次性密碼本

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377662.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377662.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377662.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

十一、紡織面料下架功能的實現

一、數據庫 數據庫仍用yy_textile表,前幾篇博文都敘述過這里就不再敘述 在fiber_yy數據庫下創建yy_textile表 初始數據庫信息 二、頁面 admin_undercarriage 三、代碼實現 admin_undercarriage using System; using System.IO; using System.Data; using S…

svg和canvas的應用場景分析【轉載】

原文地址:http://blogs.msdn.com/b/weizhong/archive/2011/07/16/canvas-svg.aspx 思考什么時候使用Canvas 和SVG wzhong 15 Jul 2011 9:07 PM 0HTML5 Canvas 和 SVG 是 IE9 中引入的兩項令人激動的圖形功能。上周在拉斯維加斯舉辦的 MIX11 大會對這兩個功能進行了介…

【C++grammar】文件系統以及path類使用

目錄1.文件系統概述1、關于路徑2、如何將某個路徑下的所有文件遞歸地找出來?2.路徑類及操作1、path類的成員函數2、path類的非成員函數示例1:展示C17中的path對象的用法示例2:展示Path類中用于分解路徑成分的函數示例3:展示path相…

scala hashmap_如何在Scala中將Hashmap轉換為Map?

scala hashmapLets first understand what are maps and hashmaps? 首先讓我們了解什么是map和hashmap ? map in Scala is a collection that stores its elements as key-value pairs, like a dictionary. Scala中的map是一個集合,將其元素存儲為鍵值…

十二、所有功能實現效果演示

一、系統項目架構 Ⅰ,fiber_yy數據庫下有五張表 yy_admin:管理員登錄賬號和密碼 yy_textile:紡織面料數據信息 yy_textile_record:用戶購買紡織面料信息所存儲的面料流水信息 yy_user:用戶登錄注冊信息 yy_user_reco…

行業軟件之PTV微觀軟件VISSIM4.3 5.0 5.1 5.2 5.3 5.4下載和相關資料

他是干什么的:http://baike.baidu.com/view/3656765.htm 中國代理銷售的公司的網址:辟途威交通科技(上海)有限公司 官網:http://www.ptvchina.cn/ 看看視頻中軟件的運行效果:http://v.youku.com/v_show/id_XMzExMjg1MDEy.html 如何…

一、單個神經元網絡構建

一、本人使用編譯器為Jupyter Notebook,tensorflow版本為1.13.1 import tensorflow as tf print(tf.__version__) """ 1.13.1 """二、訓練單個神經元網絡 x為-1.0, 0.0, 1.0, 2.0, 3.0, 4.0 y為-3.0, -1.0, 1.0, 3.0, 5.0, 7.0 人用…

ruby 生成隨機字符串_Ruby程序生成隨機數

ruby 生成隨機字符串產生隨機數 (Generating random number) The task is to generate and print random number. 任務是生成并打印隨機數。 Generating random numbers means that any number can be provided to you which is not dependent on any pre-specified condition…

leetcode 322. 零錢兌換 思考分析

目錄1、題目2、思路分析3、參考鏈接1、題目 給定不同面額的硬幣 coins 和一個總金額 amount。編寫一個函數來計算可以湊成總金額所需的最少的硬幣個數。如果沒有任何一種硬幣組合能組成總金額,返回 -1。 你可以認為每種硬幣的數量是無限的。 提示: 1 …

linux上的英文字體monospace可以在windows用嗎?

linux的字體都是開源的,應該可以官方下載本地下載轉載于:https://www.cnblogs.com/52linux/archive/2012/03/14/2396103.html

Flash Builder 創建CSS

1.global 選擇器將樣式應用于所有控件 在 Flash Builder 中創建新MXML 文件并切換到設計模式 屬性視圖右側的外觀視圖可更改外觀 Flash Builder 自動創建CSS 文件 CSS 文件有2 個命名空間: s 指 Spark 組件 mx 指 MX 組件 1. Global 與Application 選擇器 global …

ruby打印_Ruby程序打印數字的力量

ruby打印Ruby中數字的冪 (Power of a number in Ruby) The task to develop a program that prints power of a number in Ruby programming language. 開發可以用Ruby編程語言打印數字冪的程序的任務。 If we want to calculate the power of a number manually then we have…

二、訓練fashion_mnist數據集

一、加載fashion_mnist數據集 fashion_mnist數據集中數據為28*28大小的10分類衣物數據集 其中訓練集60000張,測試集10000張 from tensorflow import keras import tensorflow as tf import matplotlib.pyplot as plt import numpy as npfashion_mnist keras.data…

jquerymobile 切換頁面時候閃爍問題

https://github.com/jquery/jquery-mobile/commit/acbec71e29b6acec6cd2087e84e8434fecc0053f 可以修改css好像是個bug -4,9 4,10 * Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses.*/.spin {--webkit-animation-name: spin;--webkit-an…

二分法:兩個有序數組長度為N,找到第N、N+1大的數

題目 兩個有序數組長度為N,找到第N、N1大的數 思路1:雙指針,O(N)復雜度 簡述思路: 如果當前A指針指向的數組A的內容小于B指針指向的數組B的內容,那么A指針往右移動,然后nums(當前已經遍歷過的數字個數)也…

Javascript -- In

http://www.caveofprogramming.com/articles/javascript-2/javascript-in-using-the-in-operator-to-iterate-through-arrays-and-objects/ http://msdn.microsoft.com/en-us/library/ie/9k25hbz2(vvs.94).aspx轉載于:https://www.cnblogs.com/daishuguang/p/3392310.html

三、自動終止訓練

有時候,當模型損失函數值預期的效果時,就可以結束訓練了,一方面節約時間,另一方面防止過擬合 此時,設置損失函數值小于0.4,訓練停止 from tensorflow import keras import tensorflow as tf import matplo…

矩陣形狀| 使用Python的線性代數

Prerequisite: Linear Algebra | Defining a Matrix 先決條件: 線性代數| 定義矩陣 In the python code, we will add two Matrices. We can add two Matrices only and only if both the matrices have the same dimensions. Therefore, knowing the dimensions o…

[數據庫]oracle客戶端連服務器錯誤

昨天晚上和今天上午用11g客戶端連同事10g服務器,報錯: The Network Adapter could not establish the connection 檢查嘗試了好多次都沒好。 用程序連,依舊是報這個錯,所以一查就解決了! 參考:http://apps…

ASP.NET 抓取網頁內容

(轉)ASP.NET 抓取網頁內容 ASP.NET 抓取網頁內容-文字 ASP.NET 中抓取網頁內容是非常方便的,而其中更是解決了 ASP 中困擾我們的編碼問題。 需要三個類:WebRequest、WebResponse、StreamReader。 WebRequest、WebRespo…