学渊's profile欢迎访问尹学渊的共享空间PhotosBlogListsMore ![]() | Help |
|
欢迎访问尹学渊的共享空间Do not tell me it can't be done!!! 7/30/2007 [希腊神话] 1-The Olympian Gods [English Edition][附译文]Between Macedon and Thessaly of eastern Greece there stood a high mountain.Its cloudy top rushed into the very heavens.On the top of the mountain, the home of the gods was bathed in brightness. At Olympus Zeus ruled as the father of gods and men. Zeus was not a crude ruler by any standards.All the gods listened to his final words,it was true.But Zeus made them all sit on a committee of twelve members,including six gods and six goddesses. The first in the Olympian crowd sat Zeus himself. He was the overlord of gods and men and the operator of the thunderbolt .Next to him was Hera,his proud and green-eyed queen.Poseidon was ruler of the sea,And Hades,king of the lower world,had no seat in the committee.Apollo was the god of the sun,music and poetry,while his twin-sister Artemis was the goddess of the moon and the chase. Athena was the goddess of wisdom and patroness of house holdarts.Hestin,the goddess of the family,represented home life and family happiness.The frightening Ares was the god of war,and the charming Aphrodite the goddess of love and beauty.The god of fire,Hephaestus,was the forger of the thunderbolts of Zeus.The wing footed messenger Hermes was the god of invention and commerce;and the goddess of grains and harvests,Demeter,looked after agriculture and stood for mother of civilization. All the chief gods mentioned above took human forms of incomparable beauty and grace. Often moved by human feelings and desires,they frequently gave way to anger and jealousy.They became involved in ceaseless battles with the world of man. Among themselves at Olympus they plotted and struggled for power.In the human world they experienced competitions and difficulties.They enjoyed earthly friendships and loves.Acrowd of everlasting gods looked and acted in a perfectly human fashion that is what all gods at Olympus actually were. ======================================================================
奥林波斯山神
在马其顿和希腊东部的色萨利之间矗立着一座高山。大雾弥漫的山顶直插云霄。山顶上,众神们的家园沐浴在阳光之中。宙斯作为山神和人类之父主宰着那里的一切。总的说来,宙斯并不是一个独裁统治者。但毫无疑问,凡事山神们都要听从他的命令。宙斯将男女山神十二人组成一个委员会,宙斯本人则坐第一把交椅,是众神与人类的太上皇,也是雷电的操纵者。他旁边是他那傲慢且嫉妒的皇后赫拉。波塞冬是大海的统治者。哈得斯是主宰阴间的冥王,他在委员会中没有席位。阿波罗是太阳神、音乐和诗神。他的孪生姐妹阿耳特弥斯是月亮和狩猎女神。雅典娜是智慧女神和家居艺术品的守护女神。赫提斯是家室之神,象征着家庭中的生命与幸福。气势汹汹的阿瑞斯是战神。媚人的阿芙罗狄蒂是爱与美神。火神赫菲斯托斯是宙斯雷电的创造者。以翅代步的信使海尔墨斯掌管商业与发明事务。谷物与丰收女神得墨特尔负责管理农业,她是文明之母。 以上所提到的主要天神们都假装成凡人的样子,他们的美丽与魅力无可匹敌。因常受到凡人情感与愿望的感染,他们不时地勃然大怒,妒嫉别人。他们卷入与人类世界无休止的争斗中。在奥林波斯,他们之间也充满了阴谋与权力之争。在凡人的世界里,他们经历了敌对与挫折。他们珍惜人间的爱与友善。这群长生不老的天神们的外表与行为完全符合人间的方式。这就是奥林波斯山神们的本来面目。 -- 我想像不出他们手中敲击那些冰冷的键盘时的寂寞与孤独,想像不出他们经历失败时是否也有过放弃与逃避?但无论如何,他们成功了,就像很多成功者一样他们付出了心血和汗水,最终收获的是掌声与鲜花。我不去想是否能够成功,既然选择了远方,便只顾风雨兼程;我不去想,身后会不会袭来寒风冷雨,既然目标是地平线,留给世界的只能是背影. iPod、万 点 巨 额 点 卡、奖 学 金……海 量 奖 品,想 拿 就 拿! 5/10/2007 I like the subtle...I like the subtle...
I like the subtle fresh green budding from the branches of the tree -- the herald of spring, ushering in the dawn... I like the subtle flow of cloud that makes the sky seem I like the subtle wind. I like the subtle taste of tea that last long after a sip. I like the subtle friendship that does not hold people together. I like the subtle longing for a friend, Love should also be subtle, Subtle friendship is true;
我喜欢这种淡淡的感觉
我喜欢看树枝上那淡淡的嫩绿,它是春天的使者,它是一天清晨的开始…… 我喜欢天空中那淡淡的云,它将天空衬的更高更蓝更宽... 我喜欢淡淡的风。 我喜欢喝淡淡的茶,淡淡之中才品出它余味的清香, 我喜欢追求淡淡的友谊,彼此之间不需要天天在一起. 我喜欢淡淡地思念一个人, 爱也要淡淡的。 淡淡的一点友谊很真, -- 我想像不出他们手中敲击那些冰冷的键盘时的寂寞与孤独,想像不出他们经历失败时是否也有过放弃与逃避?但无论如何,他们成功了,就像很多成功者一样他们付出了心血和汗水,最终收获的是掌声与鲜花。我不去想是否能够成功,既然选择了远方,便只顾风雨兼程;我不去想,身后会不会袭来寒风冷雨,既然目标是地平线,留给世界的只能是背影. 免费试玩2006中国最佳网络游戏--梦幻西游 3/1/2007 网页编程安全漏洞全接触网络安全已经成为互联网最热门的话题之一,与现实相对应的,网络安全的部属、实现也就成为一个企业特别关心的问题。所以,现在我们可以很容易的看到各个企业在设计自己网络、构建企业网站的时候,对于网络安全的投入还是比较大方的,特别是一些敏感信息比较多的网站,比如银行、证券等企业,对于网络安全更是不遗余力,市场上各种宣传、广告,也都大力推广各种安全产品,比如防火墙、入侵检测、企业防病毒等一系列的产品。 但是,是不是使用了这些产品,网络特别是网站就真的安全了?不一定,即使这些安全设备最高档、设置也很合理,网站还是有被攻击甚至完全被控制的可能。 我们知道,现在的网站特别是稍微大一点的网站,一般都采用ASP、PHP或者JSP等脚本语言来连接数据库,取得数据库里面的数据生成动态网页,这样,当一个网站完全建立的以后,程序就会很多,特别是网页设计的特殊性,服务器与用户的交互程序特别多,所以,如果程序员不是很有经验或者没有强烈的安全意识,程序的漏洞就会很多,给网站带来不可估量的安全隐患。这些程序漏洞,一定程度上,可能比网站服务器的漏洞更加严重,因为这些漏洞防火墙或者入侵检测系统根本无法防止。 一、编程漏洞的形成 编程漏洞怎么形成的呢?我们需要对网页编程有比较全面的认识才可以理解。首先,我们来看看网页编程的特点。 1、网页编程交互性强 之所以采用各种语言来设计网站而不直接采用HTML,目的就是为了更好的管理网站资源,增加网站与浏览者之间的交互。所以,在网站设计的时候,一些常见的交互编程是少不了的,比如留言版、BBS论坛,聊天室等,这些程序最大的共同点就是用户输入很多资料,通过这些资料与其他浏览者交流或者与网站管理者交流。而交互的特点,正式漏洞形成的一大原因,因为用户输入信息是不可预测的,如果程序没有考虑到或者考虑不全面一些安全问题,用户输入就有可能成为攻击事件,不管有意还是无意。 2、网页编程字符处理特别多 上面我们谈到,交互其实就是信息的流通。所以,这些信息的处理就是大问题,怎样严格控制用户输入信息的内容、信息格式、信息长度都是编程需要考虑的问题。 3、网页编程涉及安全最里层 我们知道,网页编程直接和服务器打交道,这些程序都是直接和网站目录、网站数据库设置网站设置、系统设置相关,通过这些程序,可以访问网站目录、设置等几乎所有服务器内容。仔细想,这些程序其实都是很有潜在安全问题的,因为它们太敏感了。所以,如果程序设计有漏洞,几乎就等于网站有漏洞,甚至完全开放。 4、网页编程整体人员基础较差 网页编程人员的技术素质,这个问题其实我们可能比较少关注。在部分传统程序员眼中,网页程序设计其实不能称为程序员,他们认为网页程序设计,只需要美工好就可以了,完全没有技巧可言,不叫真正的编程。之所以形成这种观点,有几个原因。一是网页编程相对比较简单,变化较少,基本上,网页编程可以很简单的概括出几个类型:留言版、论坛、聊天室、邮件列表、新闻发布、软件下载等,而这些类型的编程,大部分都有模式可循,和传统编程相比,的确比较简单,任意掌握;二是网页编程人员大部分半路出家,专业的程序员相对较少,编程的系统训练较少,可能编程的基础也比较弱,所以,编程方面可以还是有一些缺陷的;三是部分网站直接下载网上免费程序来建立网站,这些程序的健壮性、安全性都没有严格考虑,如果网站采用者不自己修改这些程序而直接照搬得话,很可能存在严重安全问题。 二、编程漏洞的类型 网页编程相对比较简单,漏洞的形成实例虽然很多,但是,都有一些内在地共同点可以寻找,以此归纳出一些共同的特点,供我们参考。 1、用户输入验证不全面 在网站编程而言,有一个规则可能我们需要牢记,那就是对于用户和用户的输入,都必须抱怀疑态度,不能完全信任。所以,对于用户的输入,不能简单的直接采用,而必须经过严格验证,确定用户的输入是否符合输入规则才可以现实、录入数据库。总结用户输入验证,应该包括以下几个方面。 (1)输入信息长度验证 这一点可能我们比较少注意,因为我们往往认为一般用户不会故意将输入过分拉长,稍微有一些用户可能捣乱,但是,在这一点上可能没有危害。其实,只要我们仔细考虑,如果不进行输入验证,可能的危害会相当大,为什么?如果用户输入的信息达到几个兆,而我们的程序又没有验证长度的话,想想的危害就有:a、程序验证出错;b、变量占用大量内存,出现内存溢出,至使服务器服务停止甚至关机。这样的危害多大? (2)输入信息敏感字符检查 这一点平时在设计程序的时候我们可能都有注意,主要关注的是一些JavaScript的敏感字符,比如在设计留言版的时候,我们会将“<”等符号的信息去除,以免用户留下页面炸弹。但是,是否这些就已经足够了呢?还远远不够。我们还有很多没有注意到,以下几个方面我们需要特别注意。 a、留言版内容信息的过滤 这一点上面已经提到,平时也使用较多。 b、用户名信息的过滤 这一点其实我们常常验证,但是,用户名的验证我们往往只是验证长度,没有验证JavaScript或者HTML的标记,这样就容易形成漏洞。比如用户在用户名填入“ 2、页面行为方式缺乏逻辑 可能这一点看起来很不好理解,页面行为方式是什么呢?我们现在举例说明。在一般的网站中,注册新用户的时候,一般会首先要求用户输入自己需要注册的账号信息,以此来验证该账号是否已经存在,确保用户的单一性。这样的要求,网站编程者的考虑很好,必然新浪注册新用户的时候,就是这样要求的。然而,如果编程不谨慎,却容易造成一个很大的漏洞,致使用户信息流失、出错等情况的发生。这种情况怎样产生的呢?其实很简单,这些页面在编程的时候,认为如果用户的注册信息通过了刚才我们提到的“检测时候存在该账号”,那么,程序就认为这个账号一定不存在,可以注册,在真正的注册页面中,直接使用“Insert Into”语句将注册信息插入用户数据库就可以了。仔细看看这样的注册过程,我们发现有一个大的漏洞,那就是,将注册信息插入数据库之前,并没有再一次检查这个用户是否存在,而是很简单的信任前一个检测页面传来的账号信息。我们知道,HTML文件是可以阅读源代码并且也可以直接保存的,如果用户将注册通过的页面保存并且将上面的账号信息修改为一个已经存在的账号,由于程序认为该账号已经通过检测,于是,直接将该账号插入数据库,结果,原来拥有该账号的用户就被删除或者信息被修改了。而如果这个账号刚好是一个管理员账号,结果会怎样呢? 可能我们认为以上的情况很简单,的确简单,但是这种方式编程的程序员却很多,随便在网上找,我们可以找到很多这种方式编程的源代码和已经采用的程序。 以上就是就是页面行为方式缺乏逻辑的典型举例,还有没有其他的举例呢?我们大家都很熟悉的一个例子。在电子商务初期,一些电子商务网站的程序很多存在这样的漏洞,用户可以随意定义自己购买商品的价格!其实也就是这个原因造成的。 3、编程方式不成熟 很多时候,我们可能根本没有意识到一些漏洞的产生,这时候,不是我们没有注意安全问题,而是我们缺少经验。这种情况,我们就需要多了解一些网络攻击者的进攻方式,以此来修改程序,加固网络、程序安全。我们已经知道的一些漏洞就是这种情况产生的。在一些账号密码验证中,有万能密码的存在就是这样产生的,在下面的举例中我们会详细介绍。 4、没有基于内容的检测 上面第一条我们提到检测的漏洞,这里,我们专门提出基于内容的检测。前面多是技术上的考虑,这里,确实基于国家法律法规的考虑。一个网站的设计完成,除了技术的完善以外,还需要这个网站在国家法律法规内发布信息,不能随意让自己的网站成为一些别用心的人发布不法信息的平台。所以 ,我们有必要对所有用户输入而且有可能显示给其他用户的信息进行内容检测,一般有几类: (1)粗话的检测,一般我们检测一些常见的粗话; (2)敏感词汇的检测,必然“法轮”“明慧”等这些词; (3)关系政治的词汇,最好全部过滤,比如“共产党”等; (4)国家领导人的姓名,最好过滤; 当然,以上的一些规则,不一定全部要这样,可以根据自己留言、或者论坛的性质来决定那些需要严格过滤。 三、攻击实例 以下的实例,可能网络上有些网站刚好存在这些问题,希望存在问题的网站能够及时修改程序改正,读者也不要利用这些漏洞做不符合国家法律法规的事情。 1、万能密码 这个漏洞,一些读者可能已经知道,但是,由于网络上依然很多网站存在这些漏洞,我们还是有必要详细、全面的了解这个漏洞的形成原因和严重后果。首先,我们来看看漏洞的产生。这个漏洞是因为在程序验证账号密码的时候程序不严谨造成的。我们在程序设计的时候,常常将账号、密码放在一个叫“User”的数据表中,设置“username”和“password”两个字段,当验证的时候,检查用户的输入是否存在于这个数据表,如果存在,证明这个用户合法;不存在,证明用户不合法。漏洞的出现,就是这个验证代码的编写不严谨造成的,我们来看原代码。 ‘连接数据库 Set Conn=Server.CreateObject("ADODB.Connection") Connstr="DBQ="+server.mappath("db\news.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;ImplicitCommitSync=Yes;MaxBufferSize=512; MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;" ‘打开数据库连接 Conn.Open connstr ‘数据库选择语句 mysql="select * from user where userid=’”&txtuserid&”’ and pwd=‘”&txtpwd&” " set rs=server.createobject("adodb.recordset") rs.open mysql,conn,1,1 if not (rs.eof) then rs.close conn.close response.redirect"ok_login.asp" end if 在以上的代码中,我们看mysql的定义,这里的txtuserid和txtpwd都是直接来自用户的输入,如果用户构造特殊的用户名或者密码,就可以直接让这里的Select条件为“真”,完全不必理会是否有合法账号密码。我们这里不直接给出万能密码,希望有经验的读者仔细分析select语句,找出可能的漏洞。 以上漏洞的修改其实很多方法,我们这里提出几种比较完善的方法参考。首先,我们可以对用户输入的账号、密码进行严格检查,除了二十六个字母和十个数字,其他任何字符都是非法的,也就是过滤那些非法的字符,确保用户输入合法。注意,这个过滤要针对用户名和密码两个进行;二是修改以上的select语句或者下面的if语句,从程序设计角度堵塞漏洞的产生;三是检验用户的输入信息长度,限制输入信息在8个字母内,这样,也能防止漏洞的产生,不过,这个方法不是很好,最好利用第一种方法。 2、取得别人账号 这个漏洞原因已经在上面分析了,我们现在来看实例。首先,我们进入一个注册页面并且随意输入一个账号,发现出现账号已经存在的信息: 这样,我们知道这个账号已经存在,怎样取得这个账号的使用权呢?我们使用另外一个账号注册,如果这个账号不存在,会出现以下的页面。 以上页面,就是正常的注册页面,我们可以发现在“用户名称”后面,发现了需要注册的“kkkkkkkkk”账号,再看看这个页面的源代码,查找这个账号,看这个账号出现在哪些地方,我们只看关键的代码: 3、绕过验证的“页面炸弹” 即使页面有严格的验证,有时候,我们还是可以绕过这些验证来提交一些不合法的信息,最简单的就是采用JavaScript方式验证的程序,因为JavaScript的特殊性,我们可以将提交信息的页面保存到本地计算机,然后将这些JavaScript程序删除,再提交攻击信息,这样,轻松的,我们就可以绕过页面信息验证了。 四、总结 以上我们介绍了网页编程中容易出现的一些漏洞,这些漏洞,其实并不只是在网页编程中出现,在其他的编程中,也有一定的参考价值。从以上的介绍中可以知道,安全的概念其实贯穿在整个网页设计过程中,随时我们都要考虑到安全的问题,这样,我们的网站才会多一些安全性;同样的,作为网络攻击者,如果随时注意一些编程漏洞,很容易,网站的漏洞就可以找出来。 -- 我想像不出他们手中敲击那些冰冷的键盘时的寂寞与孤独,想像不出他们经历失败时是否也有过放弃与逃避?但无论如何,他们成功了,就像很多成功者一样他们付出了心血和汗水,最终收获的是掌声与鲜花。我不去想是否能够成功,既然选择了远方,便只顾风雨兼程;我不去想,身后会不会袭来寒风冷雨,既然目标是地平线,留给世界的只能是背影. 想加入吗?1.9亿用户正在使用网易邮箱 www.126.com 12/20/2006 迅雷产品经理笔试题迅雷产品经理笔试题 2个小时,总共8道题: 1.有7克,5克两个砝码和天平一个.只用这些物品三次,把140克盐分成50,90两份. 2.有4瓶药,其中一瓶变质了,已知变质的药的重量为没变质的质量+1,怎样只称一次就能找出变质的药. 3.一份完整的产品规划应该包括哪些内容. 4.提供一个迅雷用户注册流程设计,要求解决方便用户快速注册,与获取用户详细注册信息的矛盾. 5.怎样从迅雷5的资源信息分析用户行为 6.你最想要迅雷提供哪些增值业务 7.列举你平时最常浏览的5个网站的特色 8.迅雷竞争对手的竞争策略是什么 我想像不出他们手中敲击那些冰冷的键盘时的寂寞与孤独,想像不出他们经历失败时是否也有过放弃与逃避?但无论如何,他们成功了,就像很多成功者一样他们付出了心血和汗水,最终收获的是掌声与鲜花。我不去想是否能够成功,既然选择了远方,便只顾风雨兼程;我不去想,身后会不会袭来寒风冷雨,既然目标是地平线,留给世界的只能是背影. 昨 天 和 女 友 b u y 疯 了 ! ! ! 年 末 万 种 精 品 大 促 销 , 8 0 万 大 奖 天 天 送 ( 绝 对 保 真 ) 12/16/2006 {Software Developers Center} 制作炸药(转自google)
我想像不出他们手中敲击那些冰冷的键盘时的寂寞与孤独,想像不出他们经历失败时是否也有过放弃与逃避?但无论如何,他们成功了,就像很多成功者一样他们付出了心血和汗水,最终收获的是掌声与鲜花。我不去想是否能够成功,既然选择了远方,便只顾风雨兼程;我不去想,身后会不会袭来寒风冷雨,既然目标是地平线,留给世界的只能是背影. 想免费获得高速稳定的3G邮箱吗? www.126.com </a --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“Software Developers Center”论坛。 要在此论坛发帖,请发电子邮件到 DevelopersCenter@googlegroups.com 要退订此论坛,请发邮件至 DevelopersCenter-unsubscribe@googlegroups.com 更多选项,请通过 http://groups.google.com/group/DevelopersCenter?hl=zh-CN 访问该 论坛 -~----------~----~----~----~------~----~------~--~--- 11/28/2006 {Software Developers Center} VB Encryption TutorialP
{margin:0px;padding:0px;}
body
{font-size:10pt;font-family:Tahoma;}
Wanna be a creep? The Only VB Encryption Tutorial You Will Ever Need Contents: 1. Introduction 2. Xor 3. Substitution 4. Adding Characters 5. Advanced 6. Answers To exercises Chapter 1: Introduction Why should someone be interested in encryption? Encryption is very usefull for many purposes. Be it to make your virus harder to detect or to share sensitive information with friends. Encryption was used long before the computers were invented. In cases of war people used to encode their messages so that the enemy wouldn't be able to read them. Why shouldn't you know how to encrypt if you ever need to? First you need to know how someone can decode something that you have already encrypted. Suppose you encrypt a sentence by changeing each character to the next. "I hate to eat vegetables" -----> "J!ibuf!up!fbu!wfhfubcmft" One can use the following table with the frequency of different letters: T ( 9 % ) in ( 1.5 % ) and ( 3.1 % ) o ( 8 % ) to ( 2.3 % ) A ( 7.8 % ) E ( 13 % ) the ( 5 % ) of ( 4 % ) There are many more letters and words that i could add to this table but it is pointless. Back to our example, look how many times the letter "f" appears in the encrypted version. It is the most frequent letter, just like "E" in our table. In bigger tables it is even easier to spot these patterns. DES Encryption In this subsection of the introduction we will discuss a bit about the DES Encryption method. DES stands for Data Encryption Standard. Even though the DES encryption algorythm has been publically released no-one has managed to break the system as far as we know. What makes DES so strong is that it uses many functions on the numbers together as to make a joined strong function. The functions that it uses are those of substitution and transferring and many other advanced techniques. DES works on every bit of the message and not the byte like most other algorytms. It first takes a 64bit segment of the message and it uses a key to start manipulating it. Then the 64bit segment of 8 characters is divided in two smaller segments of 4 characters each and the process of encryption is repeated 16 times, then the small segments are joined again and the process is repeated for the last time. RSA Encryption It would be a shame not to include RSA in this tutorial since I love this encryption algorythm. The RSA method uses mathematical operations to encrypt. Each user has his own private and public key. If someone wants to send me a message for example, they will my public key to encrypt the message and I will use my private key to decrypt it. RSA is based on prime numbers. When two prime numbers are multiplied then that product can only be divided into those two prime numbers and not any other ones. But if the product is an extremely large number it is near impossible to find out which two prime numbers were used to make it up. This is what RSA is counting on. Below is how the pair of private and public keys are created: 1. The system picks two numbers 1024bits long which satisfy certain conditions. 2. The two numbers are multiplied, and the product is used as the first half of the pubkic key. 3. An odd number that satisfys certain conditions is picked and this number is used as the second half of the public key. 4. We subtract 1 from each of the numbers chosen, the prime numbers and the other odd number. Then these numbers are multiplied and we add 1 to the product. 5. The the number that we get in (4) is divided with the number that we got in (3) and this is our private key. EXERCISES: 1. How many bits are 8 characters? 2. Find the the only two prime numbers that divide exactly 65, and hence find the private key of the public key 65 3. Chapter 2: Xor Xor is the most famous encryption method out there probably because of it's ease to use. You can use the same function to encrypt and decrypt. Xor is a bitwise logical operator. Consider the example below: 00000001 is the binary equivelant of the decimal 19 00001000 is the binary equivelant of the decimal 16 Xor 00001011 00001000 ------------------------------ 00000011 which is the binary equivelant of the decimal 3 Now lets Xor the result from the previous action with anyone of the original two numbers. Lets use 19. 00000011 00001011 ----------------------- 00001000 which is the same as the second part of our first action. Xor returns 1 if ONLY ONE of the bits compared is set on 1. Below is some visual basic source code on how to perform simple Xor encryption: Sub Encrypt() key = "4" mystring = "abcdef" l = len(mystring) for i = 1 to l char1 = asc(mid(mystring, i, l)) newchar = char1 Xor key newmsg = newmsg + chr(newchar) next i end sub Now lets go through it: ###################### Sub Encrypt() # key = "4" # mystring = "abcdef" # l = len(mystring) # ####################### Here we start our sub and we initialise the variables. The Xor key in this example can only be up to 255. In a following chapter we will see a more advanced method that allowes you to use any key you want, and we will discuss a problem with Xor. mystring is the string that we will encrypt and l holds the length of our string. ############################### for i = 1 to l # char1 = asc(mid(mystring, i, l)) # newchar = char1 Xor key # newmsg = newmsg + chr(newchar) # next i # end sub # ############################## Here we start a For... Next... Loop which will perform the same action for every character in our string. First we get one character and we change it to its ASCII equivelant. Then we Xor it using our key and then we make it back into a character and add it to our new string. When the loop ends the new encrypted message will be stored in the newmsg variable. To decrypt it just change the "mystring" variable with the encrypted text. EXERCISES: 1. Xor 00101110 and 11011101 manually. 2. What is the encrypted value of "I love coderz.net" using 8 as a Xor key? Chapter 3: Substitution I don't even know if this is the proper name for this method but I call it substitution, because we actually substitute one character for another. In this method we will get the ASCII code of one character and purform some mathematical operation on it to change it to something else. For example, the ASCII code of "A" is 65. If we get this ASCII code and we add 4 to it we will get 69 (nice number, huh?). This number corresponds to E. As you can probably understant there are endless mathematical operations that u can do. Like add 3 then multiply by 4 and then divide by 3, or anything you can think of, as long as you keep in mind that the maximum a number should be is 255. Now how do we do this in VB? Easy: Sub Encrypt() mystring = "abcdef" l = len(mystring) for i = 1 to l char1 = asc(mid(mystring, i, l)) newchar = char1 + 4 newmsg = newmsg + chr(newchar) next i end sub Sub Decrypt() mystring = "abcdef" l = len(mystring) for i = 1 to l char1 = asc(mid(mystring, i, l)) newchar = char1 - 4 newmsg = newmsg + chr(newchar) next i end sub Now lets go through it: ###################### Sub Encrypt() # mystring = "abcdef" # l = len(mystring) # ####################### Here we start our sub and we initialise the variables. mystring is the string that we will encrypt and l holds the length of our string. ############################### for i = 1 to l # char1 = asc(mid(mystring, i, l)) # newchar = char1 + 4 # newmsg = newmsg + chr(newchar) # next i # end sub # ############################## Here we start a For... Next... Loop which will perform the same action for every character in our string. First we get one character and we change it to its ASCII equivelant. Then we add 4 to it (it can be anything) and then we make it back into a character and add it to our new string. When the loop ends the new encrypted message will be stored in the newmsg variable. To decrypt it just change the "mystring" variable with the encrypted text. Then to decrypt it we use the same function except that we subtract 4 instead of adding it to make it back to it's original character. EXCERCISES: 1. Encrypt the message "I am not lame" by adding 3 to each character. Chapter 4: Adding characters This is not an encryption method per se but you can use it to disguise your message. What this basically does is that it adds some characters between each letter. Lets look straight to the code: Sub Encrypt() mystring = "abcdef" l = len(mystring) for i = 1 to l char1 = mid(mystring, i, l) start: rndchar = int(rnd * 100) if rndchar > 255 then goto start newmsg = newmsg + chr(rndchar) newmsg = newmsg + char1 next i end sub Sub Decrypt() l2 = len(newmsg) for x = 2 to l2 If x = 1 Then GoTo xadd char1 = Asc(Mid(newmsg, x, l2)) newmsg2 = newmsg2 + Chr(char1) xadd: x = x + 1 Next x end sub In this chapter I will not give any excersises because as you can see everything is very straight forward. You may be able to improve on the decryption part because i wrote it late at night but this works just fine as it is. Chapter 5: Advanced First of all lets discuss some more things about Xor. Did you know that even though Xor is a very nice method of encryption it has a very big flow? Try encrypting something with the Xor method that we discussed in chapter 2. Works fine right? Now try encrypting a string containing many 0s (zeros). That's right the result you get is the Xor key that you have used. To cover up for this I suggest that you use Xor as well as substitution in the same function so that any errors due to Xoring zeros can be avoided. Another thing that we will discuss here is how to use a Xor key that can even be composed by letters and not only a number less than 255. This way your Xor key can be something like "Fuck this piece of shit tutorial 375185423196" and it will not have a problem. Sub Encrypt() mystring = "abcdef" xorkey = "lklkjsdafhlaksdjfhalkjsehf" l = Len(mystring) l2 = Len(xorkey) For x = 1 To l2 key1 = Asc(Mid(xorkey, x, l2)) Key = Key + key1 Next x If Key > 255 Then For y = 1 To Len(Key) ch1 = Asc(Mid(Key, y, Len(Key))) newkey = newkey + ch1 Next y Else newkey = Key End If For i = 1 To l char1 = Asc(Mid(mystring, i, l)) char1 = char1 Xor newkey newmsg = newmsg + Chr(char1) Next i end sub Again this sub can be improved on I guess, and if anyone improves any of these functions please send them to me if you want so that I will learn something new as well. =)) I just want to mension another last thing before I end this chapter. Use more than one of the above methods to encrypt your stuff to make it more safe. (duhhhh!!) Chapter 6: Answers to excersises Chapter 1: 1. 64bits 2. 5 and 13, private key = 32 Chapter 2: 1. 11110011 2. A(dg~m(kglmzr&fm| Chapter 3: 1. L#dp#qrw#odph EOF Check out some new online services at Windows Live Ideas—so new they haven’t even been officially released yet. Try it! --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“Software Developers Center”论坛。 要在此论坛发帖,请发电子邮件到 DevelopersCenter@googlegroups.com 要退订此论坛,请发邮件至 DevelopersCenter-unsubscribe@googlegroups.com 更多选项,请通过 http://groups.google.com/group/DevelopersCenter?hl=zh-CN 访问该 论坛 -~----------~----~----~----~------~----~------~--~--- 11/26/2006 {Software Developers Center} 自由不是什么
我想像不出他们手中敲击那些冰冷的键盘时的寂寞与孤独,想像不出他们经历失败时是否也有过放弃与逃避?但无论如何,他们成功了,就像很多成功者一样他们付出了心血和汗水,最终收获的是掌声与鲜花。我不去想是否能够成功,既然选择了远方,便只顾风雨兼程;我不去想,身后会不会袭来寒风冷雨,既然目标是地平线,留给世界的只能是背影. 一 个 邮 箱 还 不 够 用 ? 网 易 126 免 费 邮 送 你 3G 容 量,280 兆 超 大 网 盘 ! --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“Software Developers Center”论坛。 要在此论坛发帖,请发电子邮件到 DevelopersCenter@googlegroups.com 要退订此论坛,请发邮件至 DevelopersCenter-unsubscribe@googlegroups.com 更多选项,请通过 http://groups.google.com/group/DevelopersCenter?hl=zh-CN 访问该 论坛 -~----------~----~----~----~------~----~------~--~--- {Software Developers Center} 自由不是什么一 个 邮 箱 还 不 够 用 ? 网 易 126 免 费 邮 送 你 3G 容 量,280 兆 超 大 网 盘 ! --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“Software Developers Center”论坛。 要在此论坛发帖,请发电子邮件到 DevelopersCenter@googlegroups.com 要退订此论坛,请发邮件至 DevelopersCenter-unsubscribe@googlegroups.com 更多选项,请通过 http://groups.google.com/group/DevelopersCenter?hl=zh-CN 访问该 论坛 -~----------~----~----~----~------~----~------~--~--- 11/25/2006 {Software Developers Center} FW:Times(vista下载地址补充)(by come_cool@ 163.com)经测试,上次发送的http下载地址均已失效,在此深表歉意.请使用下面的地址(测试通过,文件大小2.58G): http://www.53530.com/53530/vista_5744.16384.061003-1945_x86fre_client-lrmcfre_en_cn_dvd.rar 投 票 参 加 活 动 蠃 取 炫 酷 大 奖 c2 完 美 驾 车 人 网 路 活 动 参 加 投 票 就 可 蠃 大 奖 --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“Software Developers Center”论坛。 要在此论坛发帖,请发电子邮件到 DevelopersCenter@googlegroups.com 要退订此论坛,请发邮件至 DevelopersCenter-unsubscribe@googlegroups.com 更多选项,请通过 http://groups.google.com/group/DevelopersCenter?hl=zh-CN 访问该 论坛 -~----------~----~----~----~------~----~------~--~--- {Software Developers Center} FW:Times(回馈)(by come_cool@163.com).shape {;} td {font-family:宋体;} td {font-size:12px;line-height:18px;} .gray14 {font-size:14px;}
投 票 参 加 活 动 蠃 取 炫 酷 大 奖 c2 完 美 驾 车 人 网 路 活 动 参 加 投 票 就 可 蠃 大 奖 --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“Software Developers Center”论坛。 要在此论坛发帖,请发电子邮件到 DevelopersCenter@googlegroups.com 要退订此论坛,请发邮件至 DevelopersCenter-unsubscribe@googlegroups.com 更多选项,请通过 http://groups.google.com/group/DevelopersCenter?hl=zh-CN 访问该 论坛 -~----------~----~----~----~------~----~------~--~--- |
|||||||||||||||||||
|
|