作业帮 > 小学作文 > 教育资讯

secret,message

来源:学生作业帮助网 编辑:作业帮 时间:2024/09/25 05:28:21 小学作文
secret,message小学作文

篇一:The secret message1

Secret Message

secret message

Q: How many numbers/letters here?

A:There are 26 numbers/letters here.

Q: What does number 1 represents?

A: Number 1/2/3/... represents letter A/B/C....

Jan.17th, 2015

篇二:解密key1234

? The four secret keys:

Key1 = 3, key2 = 777, key3 = -1, key4 = 45.

? The secret message:

程序运行结果截图:

? what process_keys12 does:

首先看下message1的代码:

从代码中,我们容易发现:程序的 message1的输出结果和位置由 start、 stride决定,实际上它是由start为起始下标,stride为步幅(也就是读多少字符)。

下面是主函数部分代码:

从这段代码中我们发现start和stride的赋值仅仅和dummy变量有关,那么我们就需要通过处理 key1、 key2的时候去尝试修改 dummy的值。这个 process_keys12的作用就是通过相对定位来修改dummy的值。

? Process analysis:

从上面的分析可以知道,start和stride的值是由dummy决定的,那么首先我们看下message1函数:截图上面已有,我们上面也说了,start是表示起始下标,stride是步幅,举个例子: 字符串为:1234567890A

Start=0 and stride=2, 那么产生的结果为 13579A

Start=0 and stride=3, 那么产生的结果为 1245780A

Start=0 and stride=4, 那么产生的结果为 12356790A

Start=1 and stride=3, 那么产生的结果为 235689A

知道了message1的工作原理,那么我们来看下,既然message1是这样来读data中的数据的,首先来看下data在内存中的情况:

而且,我们又知道,读取的结果字符串的开头为”From:”,那么接下来我们可以看到,按照上面的读取规则,读取的第一个字符应该是第十个或是十一个字节,那么start为9或8,又因为我们知道了开头字符串From:,很显然stride应该为3(也就是一次读两个字符),这样,start就是9。

由process_keys12可以知道,是通过key1的值来定位dummy的位置,然后通过key2的值来修改dummy的值,那好,看下内存中key和dummy的地址:

Key1和dummy在内存中只差12个字节的位子,再看看process_keys12的内容:(*((int *) (key1 + *key1)) = *key2;)很显然key1的只应该为3(int型4字节,这里int型地址加3就是地址值加12),在看看dummy的值,通过start和stride的值来分析:

那么在内存中,dummy的存储数据(占4个字节)应该是:第一个字节用int型读出为09(start=9),第二个字节用int型读出为03(stride=3),后面两个字节我们不关心,填充0,也就是dummy在内存中的值为:09 03 00 00,依据小端数据的存储格式可以知道,dummy的值为(不考虑后面两个字节,填充0)0x309,转化为十进制就是777。又因为在process_keys12中通过key1来找到dummy的地址,然后通过key2修改其值,所以key2=dummy=777.

综上,key1 = 3,key2 = 777,详细分析上面以解释。

? what process_keys34 does:

首先来看接下来的代码,显然可以看出来,我们要让程序进入并执行 msg2 = extract_message2(start, stride);也就是下面的第二个if循环:

那么可以考虑能不能让msg1==’\0’,很显然,第一个循环里process_key34函数不可能直接来改变msg1的值,message是全局变量( msg1的实际指向),key3是局部变量,而且,是在执行了process_key34函数之后才执行msg1赋值的,那么要保证执行第二个if语句,也可以考虑能否让process_key34函数在返回的时候直接跳转到目标代码呢?如果要这么做,我们就需要修改程序在运行过程中的栈帧结构中的存储数据了。现在让我们来分析一下程序在调用 process_keys34之前的栈帧结构:

从汇编码中我们可以看到在调用之前整个栈帧结构中数据的存储细节:首先是将参数 key3、 key4压入栈中保存,然后再传入这些参数(实际上是传递地址)。所以可以在 process_keys34中可以通过&key3的相对定位来改动调用者的栈帧数据。来看看调用时的栈帧结构:

在地址上ret=&key3-1(这里减1就是地址上减4,因为int型占4字节)。那么key3就求出来了,key3 = -1,接下来就是通过地址相差的值求key4了, 还是看下汇编语言吧:

原返回地址为第一行也就是:0040138E,我们想要它变成的返回地址为最后一行也就是004013BB,从process_keys34函数(*(((int *)&key3) + *key3) += *key4;)可以看出:原值加上key4的值就是修改后的值,那么key4 = 0x004013BB – 0x0040138E = 0x2D,转化为十进制就是45,即key4 = 45.

? describing the line of source code that is executed when the first call to process_keys34

returns.

解析过程上面已经说过,第一次调用process_keys34函数后,将返回到上面截图中的最后一行代码msg2 = extract_message2(start, stride)中执行。(原因见上一小题解析)。

? The meaning of the third and fourth keys in terms of variables and addresses in the

decoder program.

详细解析倒数第三小题中解释了。

篇三:系统级编程作业_Lab 4

Practice 1: ArrayStorage.cpp

输出结果为:。

打印出a的结果是“This is B”,而b的结果是一行空的。出现这种结果是因为:对于a的打印结果,a[0]到a[7],打印出指针指向的地址中的值,然后b=a后,a[8]的值即为b[8]的值,故显示出“This is B”。对于b的打印结果,由于只是分配了地址,并未给予值,故显示空行。

Practice 2:

与string相关的函数有:fgets(); strchr(); strcmp().

Practice 3:

1. The secret message.

2. The secret keys.

key1 = 3; key2 = 777

3. One paragraph describing, in your own prose, what process_keys12 does. For example, you might say that it modifies a specific program variable.

process_keys12是用来改变dummy的值的。

理由:如果不改变start和stride的值,这里会是一个死循环。而extrac_msg1之前只是调用了process_keys12,而start和stride是通过dummy而改变的,所以这个函数是用来改变dummy的值的.

4. The meaning of the first two keys in terms of variables and addresses in the decoder program. For example, you might describe key2 by saying that its X-Y bits contain the value to which variable start is set. Or you might describe key1 by saying, for example, that it must be set equal to the number of memory addresses separating the address of two specific variables. These are only examples.

process_key12()可修改地址为(&key1+key1)的内存单元的值。改后的值为key2。 所以,&key1+key1 = &dummy; &key1 = 0x0012ff38 , &dummy = 0x0012ff44 。所以,key1的值应该为0xc,即 12 。地址相加减时,key1当作地址算时,应该是乘以4再相加,因为整型占四个字节。所以,将key1的值设为3。

5. One paragraph describing, in your own prose, what process_keys34 does.

The process_key34() is to change the address which is retuned after executed. Because the function must jump over the sentence: msg1 = extract_message1(start, stride); for containing the value of msg1[0] \0.

6. One paragraph describing the line of source code that is executed when the first call to

process_keys34 returns.

process_keys34是如何改变自己执行完的返回地址的。

调用函数 process_key34()时,要将局部变量压栈。得到函数返回时下一条指令的地址。

7. The meaning of the third and fourth keys in terms of variables and addresses in the

decoder program.

Key3的地址为 0x0012ff30 key4的地址为:0x0012ff2c

篇四:CryptDB应用实例

1.安装好CryptDB配置环境,点击E豆社区

2.建议重启系统,保证初始化启动环境

3.启动Mysql服务:

sudo /usr/local/mysql/bin/mysqld_safe --lc-messages-dir="/usr/local/mysql/share/english/"

4.通过3306启动Mysql,建立数据库Cryptdbtest

mysql -u root -pletmein -h 127.0.0.1 -P 3306

create database Cryptdbtest;

5.配置Mysql-Proxy启动参数

export EDBDIR=[your cryptdb/edb directory]

export CRYPTDB_PROXY_DEBUG=true

export CRYPTDB_MODE=multi

6.启动mysql数据库代理

mysql-proxy --plugins=proxy --event-threads=4 --max-open-files=1024 \

--proxy-lua-script=$EDBDIR/../mysqlproxy/wrapper.lua \

--proxy-address=127.0.0.1:3307 \

--proxy-backend-addresses=localhost:3306

7.通过3307代理连接数据库

mysql -u root -pletmein -h 127.0.0.1 -P 3307 cryptdbtest

8.在cryptdbtest数据库中执行sql语句

(1)创建msgs、privmsg、u_mess三个表,数据库中会自动生成额外两个,此处设定加密规则详细设置

use cryptdbtest;

CREATE TABLE msgs (msgid equals privmsg.msgid integer, msgtext encfor msgid text);

CREATE TABLE privmsg (msgid integer, recid equals u_mess.userid speaksfor msgid integer, senderid speaksfor msgid integer);

CREATE TABLE u_mess (userid equals privmsg.senderid integer, username givespsswd userid text);

(2)向表中插入相应数据

INSERT INTO pwdcryptdb__u_mess (username, psswd) VALUES ('alice', 'secretalice'); INSERT INTO pwdcryptdb__u_mess (username, psswd) VALUES ('bob', 'secretbob'); INSERT INTO u_mess VALUES (1, 'alice');

INSERT INTO u_mess VALUES (2, 'bob');

INSERT INTO privmsg (5, 1, 2);

INSERT INTO msgs VALUES (5, 'secret message');

(3)查询以下数据并在Mysql-proxy中查看相应的rewrite语句,data from server,decrypted data,如以下截图所示:

SELECT * FROM msgs;

9.通过3306端口直接连接数据库,查询cryptdbtest数据库中msgs表,能显示相应加密数据,截图为相应加密数据

mysql -u root -pletmein -h 127.0.0.1 -P 3306

use cryptdbtest;

SELECT * FROM msgs;

篇五:沈阳牛津版初二英语阅读完型4

阅读理解与完型填空练习题(四)

一、阅读理解 (A)

Mr. Ling lives in China. He worked in a factory and last year he retired.

His wife died five years ago and his son works in Japan. He always has

sports and he is in good health .

One day his son called him and asked him to have a journey to Tokyo.

He was afraid to travel by plane and took the ship.

On the first morning on the ship ,Mr. Ling met an Englishman at

table .The man said to him , “Good morning”.

He thought the Englishman told his name to him. So he stood up and

said , “Ling Bing”.

The next morning, when Mr. Ling met the Englishman, he said , “good

morning.’’

And the Englishman said , “Ling Bing, Sir.”

And some days after that ,Mr. Ling told a teacher about it. Hearing

him, the teacher began to laugh and said , “ He says hello to you in

the morning.”

( )1. What does Mr. Ling do ?

A. He is a sports lover. B. A farmer.

C. A worker. D. In good health.

( )2. The old man stays at home _____________.

A. with his wife . B. with his son.

C. with his daughter. D. by himself .

( )3. Mr. Ling went to Japan by ship because_____________.

A. he thought it was safer.

B. he wanted to have sports on the ship.

C. he had little money to take a plane.

D. he had enough time to do so .

( )4.The old man told his name to the Englishman because__________.

A. he hoped to make friends with him.

B. he wanted to say hello to him.

C. he wanted him to teach him Englishman.

D. he thought “Good morning” was his name.

( )5. Which of the following is RIGHT?

A. Mr. Ling began to study English on the ship.

B. The Englishman thought “Ling Bing” means “Good morning”

in Chinese.

C. The Englishman learned much Chinese on the ship.

D. The Englishman began to teach Mr. Ling English.

(B)

Do you know about the western Lovers’Day ? When is it and how do

people celebrate it ?

In western countries ,people call such a holiday Valentine’s Day .It

is on February 14th every year. It is said that Saint Valentine is the

name of a man. The man often helped young lovers and was killed later

on that day .So people made it Lovers’Day.

On Valentine’s Day, lovers show their love for each other . They

usually send each other the Valentine’s Day cards. They also send flowers

or chocolate to each other. They often send the message of love by mail.

Sometimes ,they send the message by newspaper. The messages in newspaper

are often very short . To print such message on local newspaper is cheap.

But if the lover lives in another city or country ,it may be expensive

to print a message in a national newspaper. Sometimes ,there is a rose

on the corner of the message. It means “send you all my love with the

message”.

( )1.When is the western Lovers’Day ?

A. On February 24

C.On January 7thth every year . B. On December 14 every year. th every year.

th D. On February 14 every year.

( )2. What is “Saint Valentine” according to the passage?

A. A man’s name B. A lady’s name.

C. A story about love. D. A city in England.

( )3. How do people celebrate Valentine’s Day?

A. Send each other the Valentine’s cards.

B. Go and see Saint Valentine.

C. Go back home together.

D. All above.

( )4. Lovers don’t send their love message by

according to the passage.

A. TV B. mail C. local newspaper D. national newspaper

( )5. Which may be the best title for the passage?

A. Message of Love B. Saint Valentine

C. Valentine’s Day D. Eastern Lover’s Day

(C)

We learn a second langue mainly(主要地)by reading and reciting. It is a good way to recite everything you learned .But, I think it is also important for us to understand the meaning of each sentence and know how to use them in our daily life . If you just repeat sentences automatically like a phonograph , there may come some problems . Here is a short story about it.

A foreigner was walking in a street in France . A car from behind ran fast to him. It nearly hit him. With a sudden stop, the driver ,an Englishman got out of the car to say sorry to him.

“I’m terribly sorry .How are you ?” The driver said.

“Fine ,thank you ,and you ?” the foreigner answered with what he learned in class without a second thought .

Do you think it is a joke ? Every one of us repeats the same sentences every day in our English class. Few students pay attention to the language when they are practicing it .We can not say they are speaking English. Do you agree with me?

1. If we just repeat English sentences automatically like a phonograph, .

A. we can learn the language very well.

B. we may speak English like an Englishman.

C. there may come some problems.

D. there may come no problems.

2. Why does the writer tell us a story here ?

A. He wants to relax us.

B. He wants to bore us.

C. He wants to show us how important it is to learn English.

D. He wants to show us how important it is to use English in right

ways.

3. What can we guess about the foreign in the short story?

A. He is an Englishman. B. He comes from Australia.

C. He isn’t from an English---speaking country.

D. He knows nothing about English.

4. What did the English driver mean when he said “how are you?”in

the story?

A. He meant “How do you do ?” B. He meant “Nice to meet you!”

C. He meant “How is everything going?”

D. He meant “Are you all right?” 5. We should when we are reading and reciting them .

A. pay no attention to the meaning of the sentences.

B. know how to use the sentences.

C. write the sentences on a piece of paper.

D. repeat the sentences automatically like a phonograph.

二.完型填空

(A)

Long, long ago, there was a king in Egypt . He wanted 1 a message to a friend. The friend lived far away in Greece. Now the king wanted his friend to 2 the message, but he didn’t want anyone else to see it. He wanted it to be a secret one . How could he send his friend the secret message? The king thought and thought . Then ,he had 3 . The king called in a servant .He trusted him most and said to him , “I want you to shave all the hair off your head .” And the servant did that.

“Now ,”said the king, “I’m going to write something on 4 head.”

The servant bent down and the king wrote a message on his head . Then the king said , “I want you to stay along 5 your hair grows back. Your hair will hide message. I’m going to put you in a locked room 6 a month.” One month passed . The king 7 to see the servant and said , “Your hair has grown back. Now I want you to go to see 8 friend in Greece . And I want you to show 9 the message on your head . Only he may see it .”

When the servant got to the king’s friend , he cut his hair off again to let him read the message . Then the servant washed his head , and the message was off.

No one but the king and his friend ever knew what the message said . It was a secret message between them .It might be the 10 secret message in the world .

( )1. A: send B: sending C: to send D: sent

( )2. A: write B: read C: wrote D: reading

( )3. A: a servant B: a message C: an idea D: a friend

( )4. A: my B: your C: yours D: his

( )5. A: until B: when C: before D: after

( )6 A: in B: for C: after D: before

( )7 A: go B: goes C: went D: going

( )8 A: your B: his C: my D: mine

( )9 A: me B: him C: you D: his

( )10 A: only B: one C: best D: first

(B)

Bookworm are worms living on the books .The 1 bite pages and do harm 2 books . But sometimes , bookworms mean a particular group of 3 .These people like 4 very much and nothing else will 5 them more than books . They are also living on books .

Bookworms often have their nose in a book and keep reading 6 hours .They may hold a book in their hands when doing some . We can find people reading as they are walking in a street or travelling on a bus . So, most bookworms are sighted . For them , reading is the greatest pleasure in the world.

But nowadays , there are fewer and fewer bookworms among us . With the development of the Internet, most people would like their spare hours on the Internet , reading news or watching movies .As bookworms are dying out from our world , people are becoming networms .They live on the net and don’t like outdoor activities.

( )1. A: animals B: books C: people D: worms

( )2. A: to B: for C: in D: with

( )3: A: students B: worms C: books D: people

( )4: A: eating B: writing C: reading D: playing

( )5: A: interesting B: interested C: interest D: interests

( )6: A: for B: in C: to D: during

( )7: A: else things B: things else C: other thing D: other things

( )8: A: short B: long C: far D: good

( )9: A: to spent B: to spending C: spend D : to spend

( )10: A: More and more B: Less and less

C: Many and many D: Fewer and fewer

小学作文