【问题标题】:Can anyone tell me the name of this cipher please? [closed]谁能告诉我这个密码的名字吗? [关闭]
【发布时间】:2013-12-11 12:15:22
【问题描述】:

谁能告诉我这个密码的名字吗?

我知道这是一个简单的替换密码,只是不知道它的名字。

密钥:

help

密码字母:

a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z
h|e|l|p|a|b|c|d|f|g|i|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z

文字:

this is a test

密文:

tdfs fs h tast

【问题讨论】:

  • 这个问题似乎离题了,因为它是关于密码学的,不包括编程问题。
  • 如果它还没有被命名,我特此称它为“Lucypher”。
  • 我会说它是凯撒密码的变体,但凯撒密码不使用这样的密钥。
  • @Chris 该站点用于解答与编程和软件开发相关的问题(请参阅Help center)。您的问题纯粹是关于密码学和识别密码的名称。您可以在专门针对这些主题的网站之一(例如加密网站)找到更多帮助,但请仔细检查 their help 以查看它是否符合主题。
  • @Duncan,对不起,我没有意识到。该问题现已在此处的加密站点上重新发布:crypto.stackexchange.com/questions/12305/…

标签: encoding encode encryption substitution


【解决方案1】:

这不就是一个简单的substitution cipher吗?您刚刚将“帮助”的 4 个字母移到了前面,并将所有剩余的字母移到了右侧。

编辑

这是一个在 python 中的实现,作为 lambda、itertools 和星号 (*) 参数的练习,并浪费时间(也许是为了挽救关于在 python 中编码密码的有趣讨论):

import string
from itertools import izip, count, starmap

def cipher(s,key):
    # characters you want to translate, e.g.
    # 'abcd ... xyz '
    raw = string.ascii_lowercase + ' '

    # cipher with your key, e.g.
    # 'helpabcdfgi...z '
    sub = key + string.translate(raw, None, key)

    # create a dictionary from a character to an index
    # in the original raw value string
    m = dict( izip( raw, count() ) )

    # looks up the index in the map using: starmap(m.get, s)
    # then gets the substitution character: map( lambda i:sub[i], ...)
    # and joins them together
    return ''.join( map( lambda i:sub[i], starmap( m.get, s ) ))

还有一些测试代码来验证它是否有效:

ins = 'this is a test'
outs = cipher(ins, "help") 

print ins,' -> ',outs

exp = "tdfs fs h tast"
if exp == outs:
    print "pass :)"
else:
    print "~~ FAIL ~~", " expected ", exp

输出:

D:\temp>cipher.py
this is a test  ->  tdfs fs h tast
pass :)

【讨论】:

  • 是的,简而言之,它只是一个简单的替换密码(我会说,凯撒密码的一种变体),但由于它使用某种密钥,我想知道它是否真的有名字。
【解决方案2】:

我想我已经找到了答案。凯撒变体,“混合字母”替换密码。

简单是的,但是为了增加更多的复杂性,你可以把它放在这样的块中(成为混合字母和多字母的混合物):

  |a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z
------------------------------------------------------
 1|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z
 2|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h
 3|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e
 4|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l
 5|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p
 6|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a
 7|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b
 8|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c
 9|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d
10|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f
11|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g
12|j|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I
13|k|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j
14|m|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k
15|n|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m
16|o|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n
17|q|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o
18|r|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q
19|s|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r
20|t|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s
21|u|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t
22|v|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u
23|w|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v
24|x|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w
25|y|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x
26|z|h|e|l|p|a|b|c|d|f|g|I|j|k|m|n|o|q|r|s|t|u|v|w|x|y

这将更像是 Vigenere Cipher 变体而不是 Caesar Cipher 变体。

还是用钥匙:

help

同样的信息:

this is a test

会变成:

tfiv kx c hkep

另一个复杂程度是将字母组合在一起或分成块:

tfivkxchkep

或被屏蔽(3 个字符):

tfi
vkx
chk
epz

    With an extra z added to make up the missing character.

【讨论】:

    猜你喜欢
    • 2020-09-06
    • 1970-01-01
    • 1970-01-01
    • 2014-11-10
    • 2017-09-15
    • 2015-12-28
    • 1970-01-01
    • 1970-01-01
    • 2013-05-29
    相关资源
    最近更新 更多