编程介的小学生 2020-09-18 10:17 采纳率: 20.5%
浏览 53
已结题

Steganography 代码实现的原理

Problem Description
In cryptography, the goal is to encrypt a message so that, even if the the message is intercepted, only the intended recipient can decrypt it. In steganography, which literally means "hidden writing", the goal is to hide
the fact that a message has even been sent. It has been in use since 440 BC. Historical methods of steganography include invisible inks and tatooing messages on messengers where they can't easily be seen. A modern method is to encode a message using the least-significant bits of the RGB color values of pixels in a digital image.
For this problem you will uncover messages hidden in plain text. The spaces within the text encode bits; an odd number of consecutive spaces encodes a 0 and an even number of consecutive spaces encodes a 1. The
four texts in the example input below (terminated by asterisks) encode the following bit strings: 11111, 000010001101101, 01, and 000100010100010011111. Each group of five consecutive bits represents a
binary number in the range 0–31, which is converted to a character according to the table below. If the last group contains fewer than five bits, it is padded on the right with 0's.
" " (space) 0
"A" – "Z" 1–26
"'" (apostrophe) 27
"," (comma) 28
"-" (hyphen) 29
"." (period) 30
"?" (question mark) 31
The first message is 111112 = 3110 = "?". The second message is (00001, 00011, 01101)2 = (1, 3, 13)10 =
"ACM". The third message is 010002 = 810 = "H", where the underlined 0's are padding bits. The fourth message is (00010, 00101, 00010, 01111, 10000)2 = (2, 5, 2, 15, 16)10 = "BEBOP".

Input
The input consists of one or more texts. Each text contains one or more lines, each of length at most 80 characters, followed by a line containing only "*" (an asterisk) that signals the end of the text. A line containing only "#" signals the end of the input. In addition to spaces, text lines may contain any ASCII letters, digits, or punctuation, except for "*" and "#", which are used only as sentinels.

Output
For each input text, output the hidden message on a line by itself. Hidden messages will be 1–64 characters long.
Note: Input text lines and output message lines conform to all of the whitespace rules listed in item 7 of Notes to Teams except that there may be consecutive spaces within a line. There will be no spaces at the beginning or end of a line.

Sample Input
Programmer,
I would like to see
a question
mark.
*
Behold, there is more to me than you might
think when you read me the first time.
*
Symbol for hydrogen?
*
A B C D E F G H I J K L M N O P Q R S T U V
*
#

Sample Output
?
ACM
H
BEBOP

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 arduino控制ps2手柄一直报错
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥85 maple软件,solve求反函数,出现rootof怎么办?
    • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题
    • ¥15 Visual Studio问题
    • ¥20 求一个html代码,有偿
    • ¥100 关于使用MATLAB中copularnd函数的问题