Cryptography and Network Security: Principles and Practice(Lesson 2 notes)

Playfair Cipher

Operation steps

  1. Construct a 5×5 letter matrix based on
  2. The matrix is ​​constructed using a keyword (key)
  3. Then from left to right, from top to bottom; fill in the letters of the key in sequence (note: repeated letters in the key are not filled in), and then fill in the other letters in alphabetical order
  4. Letters I and J count as one letter

For example: take the keyword (key): monument, then the letter matrix is ​​as shown below (the matrix can only hold 25 letters, I and J are the same)
在这里插入图片描述

Encryption rules

The Playfair encryption algorithm first groups the plaintext into groups of two letters, and then finds the corresponding ciphertext in the matrix

  1. If the same letters appear in a group in the plaintext, insert a padding letter (eg: z) into the repeated plaintext letters to separate them and then regroup them (eg: balloon is regrouped intoba lz lo on)
  2. If there is only one letter when grouping into the last group, add the letter z
  3. If the plaintext letters are in the same row in the matrix, the loop will take the next letter to the right as the ciphertext (the next rightmost letter in the matrix is ​​the first leftmost letter) (eg: ar is encrypted as RM)
  4. If the plaintext letters are in the same column in the matrix, then the next letter below it is looped to be the ciphertext (the next letter at the bottom of the matrix is ​​the first one at the top) (eg: mu is encrypted as CM)
  5. If the plaintext letters are in different rows and different columns in the matrix, the letters in the same row and in the same column as another letter in the same group are the ciphertext (eg: hs is encrypted as BP, ea is encrypted as IM or JM)

Note: If the same letters appear in the keywords (keys), you need to remove the duplicate keys (skip if there are duplicates)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/1534904.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

Open-Sora代码详细解读(2):时空3D VAE

Diffusion Models视频生成 前言:目前开源的DiT视频生成模型不是很多,Open-Sora是开发者生态最好的一个,涵盖了DiT、时空DiT、3D VAE、Rectified Flow、因果卷积等Diffusion视频生成的经典知识点。本篇博客从Open-Sora的代码出发,深…

嵌入式软件黑盒测试技术与案例分析培训

黑盒测试,也称为基于需求的测试,是目前嵌入式软件领域普遍开展的一种测试过程。目前,随着人们对软件质量要求的不断提升,行业对软件测试和验证的要求也在不断提高,对测试的充分性和准确性要求越来越苛刻。当前行业内&a…

物联网平台架构图

在数字化时代,物联网(IoT)正逐渐成为连接物理世界与数字世界的桥梁。物联网架构,作为这一桥梁的核心,是一个多层次、分布式的网络系统,它通过将各种物理设备与传感器连接到互联网上,实现设备之间…

GLSL 棋盘shader

今日永杰开金 float size 100.;vec2 checkerboard mod(floor(gl_FragCoord.xy / size), 2.);float c mod(checkerboard.x checkerboard.y, 2.);gl_FragColor vec4(vec3(c), 1);或 vec2 uv floor(S * p.xy * vec2(iResolution.x / iResolution.y, 1) / iResolution.xy); …

华为SMU02B1管理模块WEB登录与账户密码信息

1、将电脑的IP地址与SMU02B1的IP地址配置在同一个网段中。例如,如果监控的IP地址为192.168.0.11,子网掩码为255.255.255.0,默认网关为192.168.0.1,则电脑的IP地址设置成192.168.0.12,子网掩码设置成255.255.255.0&…

Python+Pytest框架,“conftest.py文件编写如何获取token和获取日志“?

1、新增"conftest.py" import pytest import loggingfrom api_keyword.api_key import ApiKey from config import *# 获取token # 1. 正常的请求对应的接口并且提取数据 # 2. pytest.fixture()测试夹具(测试前置、后置操作)pytest.fixture(s…

ESP32开发 -- VSCODE+PlatformIO环境安装

参看官网安装:PlatformIO IDE for VSCode 一、安装PlatformIO IDE 参看:日常生活小技巧 – Visual Studio Code 简单使用 扩展中搜索platformIO IDE 当安装完提示重启之后。 打开一个要创建新工程的文件夹: 点击 Create New Project&…

【高等数学学习记录】函数

【高等数学&学习记录】函数 从事测绘工作多年,深刻感受到基础知识的重要及自身在这方面的短板。 为此,打算重温测绘工作所需基础知识。练好基本功,为测绘工作赋能。 1 知识点 1.1 函数 设数集 D ⊂ R D\subset R D⊂R,称映射…

java开发中间件学习记录(持续更新中~)

1 Redis 2JVM 3 java基础底层 4Mysql 5 spring 6 微服务 7.......(持续更新) One:Redis篇 1:Redis 1.穿透 1.1缓存穿透 1.1.1布隆过滤器 1.2缓存击穿 2:击穿 1.3:缓存雪崩 1.4:双写一致 1.5.持久化(RDB,AOF) 1.6…

电脑桌面数据误删如何恢复?提供一份实用指南

电脑桌面作为我们工作和学习的主要界面,存放着大量重要的文件。一旦这些数据不慎被删除,不仅会影响我们的工作效率,还可能造成无法挽回的损失。幸运的是,通过一些有效的方法,我们有机会恢复这些误删的桌面数据。本文将…

Leetcode面试经典150题-79.搜索单词

题目比较简单,回溯最基础的题,记得除非覆盖,否则一定要恢复现场就行 解法都在代码里,不懂就留言或者私信 class Solution {public boolean exist(char[][] board, String word) {int m board.length; int n board[0].length;i…

AI周报(9.8-9.14)

AI应用-NEKO Health用AI颠覆体检 Neko Health 由 Spotify 创始人丹尼尔埃克和哈亚尔马尔尼尔森共同创立,致力于通过每年的全身扫描和由 AI 驱动的洞察力来改善预防性医疗保健,能够检测诸如心脏病和皮肤癌等疾病。 该公司通过使用人工智能软件支持的全身…

基于Python的量化交易回测框架Backtrader初识记录(二)

版权声明:本文为博主原创文章,如需转载请贴上原博文链接:基于Python的量化交易回测框架Backtrader初识记录(二)-CSDN博客 前言:在上一篇文章 基于Python的量化交易回测框架Backtrader初识记录(一…

转置卷积与反卷积的区分

transposed convolution(转置卷积)和deconvolution(反卷积)是两个完全不同的概念。 deconvolution为“inverse of convolution”、“inverse filter”,翻译为反卷积、解卷积。在信号处理中,反卷积是指从卷积…

Golang协程泄漏定位和排查

Golang协程泄漏定位和排查 1 场景:无缓冲channel写阻塞2 排查和定位思路2.1 Golang pprof2.2 协程数监控2.3 操作系统内存泄漏 参考 1 场景:无缓冲channel写阻塞 package mainimport ("log""net/http"_ "net/http/pprof"…

JavaScript --函数的作用域(全局和局部)

全局作用域 全局作用域&#xff0c;就算不在一个script标签也能调用 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta http-equiv"X-UA-Compatible" content"IEedge"><meta nam…

【win工具】win安装flameshot并设置截图快捷键

1.下载flameshot软件2.windows端配置flameshot快捷键3.取消win自带截图快捷键 1.下载flameshot软件 https://flameshot.org/#download installer版本为安装包 portable版本为免安装版 2.windows端配置flameshot快捷键 https://cloud.tencent.com/developer/article/2114952 W…

第三方软件测评机构分享:软件性能测试的测试方法和内容

软件性能测试是对软件系统在特定负载和条件下的性能进行评估的过程。它旨在确定软件的响应时间、稳定性、资源消耗及其可扩展性&#xff0c;以确保其在实际环境中能够满足用户的需求。通过性能测试&#xff0c;开发团队能够发现潜在的瓶颈问题&#xff0c;优化应用程序架构&…

Spring3-IoC1-IoC容器、基于xml管理bean

目录 IoC容器 概述 依赖注入 IoC容器在Spring中的实现 基于xml管理bean 获取bean 依赖注入 setter注入 构造器注入 特殊值处理 字面量赋值 null值 xml实体 CDATA节 特殊类型属性注入 对象类型属性注入 方式一&#xff1a;引用外部bean 方式二&#xff1a;内部…

基于OpenSSL的密码管理系统-应用密码学课程报告

第1章 概要设计 1.1 设计目的 本研究旨在设计并实现一个基于OpenSSL的密码管理系统&#xff0c;该系统具备密钥对的生成、密钥上传、密钥的核对、身份认证、文件与邮件的加密和解密、数字签名及数字证书管理等常用功能。研究的意义主要体现在以下几个方面&#xff1a; 提升网…