1.工程试验优化设计内容简介
2.使ç¨javaå¼å代ç ç¼è¾å¨(使ç¨javaå¼å代ç ç¼è¾å¨ç好å¤)
3.79C3125EAC1CE25EE2C99A9B01DFC00
工程试验优化设计内容简介
本书深入探讨了工程试验优化设计的理论与实践内容,旨在为工程领域的优设专业人士提供全面的指导。它首先从基础层面讲解工程试验设计的计源基本理念和操作技巧,强调其在工程实践中的设计c 微信源码正确运用。内容涵盖了试验设计的最最优基础知识,如试验设计统计基础,优设c 启动窗体源码以及一系列实用的计源试验设计方法,如简单试验设计、设计正交试验设计、最最优回归分析等。优设
对于较为复杂的计源试验设计,如回归正交设计、设计回归旋转设计、最最优大数据c 源码D-最优设计,优设书中都以工程实践为导向,计源用浅显易懂的全景制作网站源码语言进行了详尽的阐述。混料设计和均匀设计也是本书的重点部分,为解决实际工程问题提供了有效的设计策略。
无论你是model生成工具 源码高等院校相关专业的本科生还是研究生,或是致力于工程实践的技术人员或科研人员,这本书都是不可或缺的参考资料。它不仅提供理论知识,更是实践应用的指南,有助于提升你在工程试验优化设计领域的理解和应用能力。
使ç¨javaå¼å代ç ç¼è¾å¨(使ç¨javaå¼å代ç ç¼è¾å¨ç好å¤)
javaç¼ç¨å¸¸ç¨ç软件æåªäº
æ³è¦å好Javaå¼åï¼æ²¡æ常ç¨çå¼åå·¥å ·å¯ä¸è¡ãèJavaåå¦è å¾å¾å¤äºå¯¹Javaè¿ä¸ç¥å解çç¶æï¼å¯¹äºJavaå¼åå·¥å ·çäºè§£ä¹ä¸ä¼å¤ªå¤ï¼å¸¸å¸¸ä¼ä¸ºäºæ¾å¼åå·¥å ·è浪费大éçæ¶é´ãç»å¤§å®¶ä»ç»ä¸Javaå¼åå·¥ç¨å¸å¸¸ç¨çå¼åå·¥å ·æåªäºã
第ä¸ä¸ªJava常ç¨çå¼åå·¥å ·ä¸ºJDKï¼ä¹å«Java软件å¼åå·¥å ·å ï¼æ¯ä¸ä¸ªç¼åJavaçAppletå°ç¨åºååºç¨ç¨åºçç¨åºå¼åç¯å¢ï¼JDKä¸è¿å æ¬äºJavaçå¼åç¯å¢ï¼æ以ä¸è½½äºJDKå°±å å«äºJavaå¼åç¯å¢ãèä¸JDKä¹æ以被å«åJava软件å¼åå·¥å ·å ï¼æ¯å 为å®å å«äºå ¶å®Javaå¼åå·¥å ·ï¼å¦ï¼ç¼è¯å·¥å ·(javac.exe)ãæå å·¥å ·(jar.exe)çã
第äºä¸ªæ¯JavaIDEï¼Eclipseï¼Eclipseæ¯ä¸ä¸ªå¼æ¾æºä»£ç çãåºäºJavaçå¯æ©å±å¼åå¹³å°ãå°±å ¶æ¬èº«èè¨ï¼å®åªæ¯ä¸ä¸ªæ¡æ¶åä¸ç»æå¡ï¼ç¨äºéè¿æ件ç»ä»¶æ建å¼åç¯å¢ãèä¸ç±äºå®çå¹³çåä¸è´æ§ï¼ä½¿å¾å ¶å®å¼åè¯è¨ä¹å¯ä»¥å¨eclipseä¸ä½¿ç¨ã
第ä¸ä¸ªæ¯notepad++ï¼notepad++æ¯ä¸ä¸ªç¼è¯å·¥å ·ï¼å®çä¼ç¹æ¯å³ä½¿ä½ ææ件å æäºï¼å¦æånotepad++ä¸æå¼è¿ï¼é£ä¹é£éå°±ä¼ä¿çï¼æ以对ä¸äºå®¹æ误å ç人æ¥è¯´æ¯è¾å好ï¼notepad++å¯ä»¥ç¨æ¥æ¿ä»£notepadã
第å个æ¯VisualStudioCodeï¼å®æ¯ä¸ä¸ªè¿è¡äºMacOSXãWindowsåLinuxä¹ä¸ç跨平å°æºä»£ç ç¼è¾å¨ãèä¸è¿ä¸ªç¼è¾å¨æ¯æå¤ç§è¯è¨åæ ¼å¼çç¼åã
以ä¸å°±æ¯æ¯è¾å¸¸ç¨ç4ç§Javaå¼åå·¥å ·ï¼Javaçåå¦è å¨å¯¹å¼åå·¥å ·ä¸äºè§£çæ åµä¸ï¼å¯ä»¥æ ¹æ®ä¸è¿°ä»ç»æ¥éæ©éåèªå·±çå¼åå·¥å ·ï¼è¿æ ·å¯ä»¥åå°èªå·±å°å¤æ¾å¼åå·¥å ·è¿å¯è½æ¾å°ä¸éåçæ浪费çæ¶é´ã
å¦ä½ç¨javaç¼åä¸ä¸ªç®åçææ¬ç¼è¾å¨ï¼
importjava.awt.*;\x0d\importjava.awt.event.*;\x0d\importjavax.swing.*;\x0d\importjava.io.*;\x0d\\x0d\publicclassf1extendsFrameimplementsActionListener\x0d\{ \x0d\privateMenuBarmenubar=newMenuBar();\x0d\privateMenufilemenu=newMenu("æ件");\x0d\privateMenueditmenu=newMenu("ç¼è¾");\x0d\privateMenuformmenu=newMenu("æ ¼å¼");\x0d\privateMenuItem[]itemf=newMenuItem[4];\x0d\privateMenuItem[]iteme=newMenuItem[6];\x0d\privateMenuItem[]items=newMenuItem[2];\x0d\privateTextAreatf=newTextArea();\x0d\\x0d\publicinta=0,b=0,c=0,style=Font.PLAIN,size=;\x0d\publicStrings1="red:"+a+""+"green:"+b+""+"blue"+c,\x0d\s2="å®ä½";\x0d\\x0d\publicString[]sz1={ "","","","","",""},\x0d\sz2={ "å®ä½","é»ä½","å¹¼å","é¶ä¹¦","è¡æ¥·","Arial","Georgia"},\x0d\sz3={ "ç²ä½","å¾æ","常è§","ç²æ"};\x0d\\x0d\JDialogdialog=newJDialog(this,"åä½",true);\x0d\Containercp=dialog.getContentPane();\x0d\JLabel[]lb=newJLabel[8];\x0d\JLabellb1=newJLabel(s1,JLabel.LEFT);\x0d\JButtonb1=newJButton("ç¡®å®"),\x0d\b2=newJButton("åæ¶");\x0d\JComboBoxjc1=newJComboBox(),\x0d\jc2=newJComboBox(),\x0d\jc3=newJComboBox();\x0d\JScrollBarjb1=newJScrollBar(JScrollBar.HORIZONTAL,,5,0,);\x0d\JScrollBarjb2=newJScrollBar(JScrollBar.HORIZONTAL,,5,0,);\x0d\JScrollBarjb3=newJScrollBar(JScrollBar.HORIZONTAL,,5,0,);
javaæºä»£ç ç¼è¾å¨è®¾è®¡ç¨äºç¼åJavaæºä»£ç çç¼è¾å¨ï¼åºæ¬è¦æ±ï¼å¯ä»¥å®ææºç¨åºçæ件æå¼ï¼ç¼è¾åæ件ä¿åä¸.é«äº®çå 容:
éè¦é«äº®çå 容æ:
1.å ³é®å,å¦public,int,trueç.
2.è¿ç®ç¬¦,å¦+,-,*,/ç
3.æ°å
4.é«äº®å符串,å¦"exampleofstring"
5.é«äº®åè¡æ³¨é
6.é«äº®å¤è¡æ³¨é
äº.å®ç°é«äº®çæ ¸å¿æ¹æ³:
StyledDocument.setCharacterAttributes(intoffset,intlength,AttributeSets,booleanreplace)
ä¸.ææ¬ç¼è¾å¨éæ©.
Javaä¸æä¾çå¤è¡ææ¬ç¼è¾å¨æ:JTextComponent,JTextArea,JTextPane,JEditorPaneç,é½å¯ä»¥ä½¿ç¨.ä½æ¯å 为è¯æ³çè²ä¸ææ¬è¦ä½¿ç¨å¤ç§é£æ ¼çæ ·å¼,æ以è¿äºææ¬ç¼è¾å¨çdocumentè¦ä½¿ç¨StyledDocument.
JTextArea使ç¨çæ¯PlainDocument,æ¤documentä¸è½è¿è¡å¤ç§æ ¼å¼ççè².
JTextPane,JEditorPane使ç¨çæ¯StyledDocument,é»è®¤å°±å¯ä»¥ä½¿ç¨.
为äºå®ç°è¯æ³çè²,å¯ä»¥ç»§æ¿èªDefaultStyledDocument,è®¾ç½®å ¶ä¸ºè¿äºææ¬ç¼è¾å¨çdocumet,æè ä¹å¯ä»¥ç´æ¥ä½¿ç¨JTextPane,JEditorPaneæ¥å.为äºæ¹ä¾¿,è¿éå°±ç´æ¥ä½¿ç¨JTextPaneäº.
å.ä½æ¶è¿è¡çè².
å½ææ¬ç¼è¾å¨ä¸æå符被æå ¥æè å é¤æ¶,ææ¬çå 容就åçäºåå,è¿æ¶æ£æ¥,è¿è¡çè².
为äºçè§å°ææ¬çå 容åçäºåå,è¦ç»documentæ·»å ä¸ä¸ªDocumentListenerçå¬å¨,å¨ä»çremoveUpdateåinsertUpdateä¸è¿è¡çè²å¤ç.
èchangedUpdateæ¹æ³å¨ææ¬çå±æ§ä¾å¦åæ¯è²,èæ¯è²,åä½çé£æ ¼æ¹åæ¶æä¼è¢«è°ç¨.
@Override
publicvoidchangedUpdate(DocumentEvente){
}
@Override
publicvoidinsertUpdate(DocumentEvente){
try{
colouring((StyledDocument)e.getDocument(),e.getOffset(),e.getLength());
}catch(BadLocationExceptione1){
e1.printStackTrace();
}
}
@Override
publicvoidremoveUpdate(DocumentEvente){
try{
//å 为å é¤åå æ ç´§æ¥çå½±åçåè¯ä¸¤è¾¹,æ以é¿åº¦å°±ä¸éè¦äº
colouring((StyledDocument)e.getDocument(),e.getOffset(),0);
}catch(BadLocationExceptione1){
e1.printStackTrace();
}
}
äº.çè²èå´:
pos:æåååå æ çä½ç½®.
len:æååçå符æ°.
ä¾å¦æå ³é®åpublic,int
åè¯"publicint",å¨"public"å"int"ä¸æå ¥ä¸ä¸ªç©ºæ ¼ååæ"publicint",ä¸ä¸ªåè¯åæäºä¸¤ä¸ª,è¿æ¶å¯¹"public"å"int"è¿è¡çè².
çè²èå´æ¯publicä¸pçä½ç½®åintä¸tçä½ç½®å 1,å³æ¯posåé¢åè¯å¼å§çä¸æ åpos+lenå¼å§åè¯ç»æçä¸æ .æ以ä¸ä¾ä¸è¦çè²çèå´æ¯"publicint".
æä¾äºæ¹æ³indexOfWordStartæ¥åå¾posååè¯å¼å§çä¸æ ,æ¹æ³indexOfWordEndæ¥åå¾posååè¯ç»æçä¸æ .
publicintindexOfWordStart(Documentdoc,intpos)throwsBadLocationException{
//ä»poså¼å§ååæ¾å°ç¬¬ä¸ä¸ªéåè¯å符.
for(;pos0isWordCharacter(doc,pos-1);--pos);
returnpos;
}
publicintindexOfWordEnd(Documentdoc,intpos)throwsBadLocationException{
//ä»poså¼å§ååæ¾å°ç¬¬ä¸ä¸ªéåè¯å符.
for(;isWordCharacter(doc,pos);++pos);
returnpos;
}
ä¸ä¸ªå符æ¯åè¯çææå符:æ¯åæ¯,æ°å,ä¸å线.
publicbooleanisWordCharacter(Documentdoc,intpos)throwsBadLocationException{
charch=getCharAt(doc,pos);//åå¾å¨ææ¡£ä¸posä½ç½®å¤çå符
if(Character.isLetter(ch)||Character.isDigit(ch)||ch=='_'){ returntrue;}
returnfalse;
}
æ以çè²çèå´æ¯[start,end]:
intstart=indexOfWordStart(doc,pos);
intend=indexOfWordEnd(doc,pos+len);
å .å ³é®åçè².
ä»çè²èå´çå¼å§ä¸æ èµ·è¿è¡å¤æ,å¦ææ¯ä»¥åæ¯å¼æè ä¸å线å¼å¤´,å说ææ¯åè¯,é£ä¹å åå¾è¿ä¸ªåè¯,å¦æè¿ä¸ªåè¯æ¯å ³é®å,å°±è¿è¡å ³é®åçè²,å¦æä¸æ¯,å°±è¿è¡æ®éççè².çè²å®è¿ä¸ªåè¯å,继ç»åé¢ççè²å¤ç.å·²ç»çè²è¿çå符,å°±ä¸åè¿è¡çè²äº.
publicvoidcolouring(StyledDocumentdoc,intpos,intlen)throwsBadLocationException{
//åå¾æå ¥æè å é¤åå½±åå°çåè¯.
//ä¾å¦"public"å¨båæå ¥ä¸ä¸ªç©ºæ ¼,å°±åæäº:"public",è¿æ¶å°±æ两个åè¯è¦å¤ç:"pub"å"lic"
//è¿æ¶è¦åå¾çèå´æ¯pubä¸påé¢çä½ç½®ålicä¸cåé¢çä½ç½®
intstart=indexOfWordStart(doc,pos);
intend=indexOfWordEnd(doc,pos+len);
charch;
while(startend){
ch=getCharAt(doc,start);
if(Character.isLetter(ch)||ch=='_'){
//å¦ææ¯ä»¥åæ¯æè ä¸å线å¼å¤´,说ææ¯åè¯
//pos为å¤çåçæåä¸ä¸ªä¸æ
start=colouringWord(doc,start);
}else{
//SwingUtilities.invokeLater(newColouringTask(doc,pos,wordEnd-pos,normalStyle));
++start;
}
}
}
publicintcolouringWord(StyledDocumentdoc,intpos)throwsBadLocationException{
intwordEnd=indexOfWordEnd(doc,pos);
Stringword=doc.getText(pos,wordEnd-pos);//è¦è¿è¡çè²çåè¯
if(keywords.contains(word)){
//å¦ææ¯å ³é®å,å°±è¿è¡å ³é®åççè²,å¦å使ç¨æ®éççè².
//è¿éæä¸ç¹è¦æ³¨æ,å¨insertUpdateåremoveUpdateçæ¹æ³è°ç¨çè¿ç¨ä¸,ä¸è½ä¿®æ¹docçå±æ§.
//ä½æ们åè¦è¾¾å°è½å¤ä¿®æ¹docçå±æ§,æ以ææ¤ä»»å¡æ¾å°è¿ä¸ªæ¹æ³çå¤é¢å»æ§è¡.
//å®ç°è¿ä¸ç®ç,å¯ä»¥ä½¿ç¨æ°çº¿ç¨,ä½æ¾å°swingçäºä»¶éåéå»å¤çæ´è½»ä¾¿ä¸ç¹.
SwingUtilities.invokeLater(newColouringTask(doc,pos,wordEnd-pos,keywordStyle));
}else{
SwingUtilities.invokeLater(newColouringTask(doc,pos,wordEnd-pos,normalStyle));
}
returnwordEnd;
}
å 为å¨insertUpdateåremoveUpdateæ¹æ³ä¸ä¸è½ä¿®æ¹documentçå±æ§,æ以çè²çä»»å¡æ¾å°è¿ä¸¤ä¸ªæ¹æ³å¤é¢,æ以使ç¨äºSwingUtilities.invokeLateræ¥å®ç°.
privateclassColouringTaskimplementsRunnable{
privateStyledDocumentdoc;
privateStylestyle;
privateintpos;
privateintlen;
publicColouringTask(StyledDocumentdoc,intpos,intlen,Stylestyle){
this.doc=doc;
this.pos=pos;
this.len=len;
this.style=style;
}
publicvoidrun(){
try{
//è¿éå°±æ¯å¯¹å符è¿è¡çè²
doc.setCharacterAttributes(pos,len,style,true);
}catch(Exceptione){ }
}
}
ä¸:æºç
å ³é®åçè²çå®æ代ç å¦ä¸,å¯ä»¥ç´æ¥ç¼è¯è¿è¡.对äºæ°å,è¿ç®ç¬¦,å符串çççè²å¤çå¨ä»¥åçæç¨ä¸ä¼ç»§ç»è¿è¡è¯¦è§£.
importjava.awt.Color;
importjava.util.HashSet;
importjava.util.Set;
importjavax.swing.JFrame;
importjavax.swing.JTextPane;
importjavax.swing.SwingUtilities;
importjavax.swing.event.DocumentEvent;
importjavax.swing.event.DocumentListener;
importjavax.swing.text.BadLocationException;
importjavax.swing.text.Document;
importjavax.swing.text.Style;
importjavax.swing.text.StyleConstants;
importjavax.swing.text.StyledDocument;
publicclassHighlightKeywordsDemo{
publicstaticvoidmain(String[]args){
JFrameframe=newJFrame();
JTextPaneeditor=newJTextPane();
editor.getDocument().addDocumentListener(newSyntaxHighlighter(editor));
frame.getContentPane().add(editor);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(,);
frame.setVisible(true);
}
}
/
***å½ææ¬è¾å ¥åºçæå符æå ¥æè å é¤æ¶,è¿è¡é«äº®.
*
*è¦è¿è¡è¯æ³é«äº®,ææ¬è¾å ¥ç»ä»¶çdocumentè¦æ¯styleddocumentæè¡.æ以ä¸è¦ç¨JTextArea.å¯ä»¥ä½¿ç¨JTextPane.
*
*@authorBiao
*
*/
classSyntaxHighlighterimplementsDocumentListener{
privateSetStringkeywords;
privateStylekeywordStyle;
privateStylenormalStyle;
publicSyntaxHighlighter(JTextPaneeditor){
//åå¤çè²ä½¿ç¨çæ ·å¼
keywordStyle=((StyledDocument)editor.getDocument()).addStyle("Keyword_Style",null);
normalStyle=((StyledDocument)editor.getDocument()).addStyle("Keyword_Style",null);
StyleConstants.setForeground(keywordStyle,Color.RED);
StyleConstants.setForeground(normalStyle,Color.BLACK);
//åå¤å ³é®å
keywords=newHashSetString();
keywords.add("public");
keywords.add("protected");
keywords.add("private");
keywords.add("_int9");
keywords.add("float");
keywords.add("double");
}
publicvoidcolouring(StyledDocumentdoc,intpos,intlen)throwsBadLocationException{
//åå¾æå ¥æè å é¤åå½±åå°çåè¯.
//ä¾å¦"public"å¨båæå ¥ä¸ä¸ªç©ºæ ¼,å°±åæäº:"public",è¿æ¶å°±æ两个åè¯è¦å¤ç:"pub"å"lic"
//è¿æ¶è¦åå¾çèå´æ¯pubä¸påé¢çä½ç½®ålicä¸cåé¢çä½ç½®
intstart=indexOfWordStart(doc,pos);
intend=indexOfWordEnd(doc,pos+len);
charch;
while(startend){
ch=getCharAt(doc,start);
if(Character.isLetter(ch)||ch=='_'){
//å¦ææ¯ä»¥åæ¯æè ä¸å线å¼å¤´,说ææ¯åè¯
//pos为å¤çåçæåä¸ä¸ªä¸æ
start=colouringWord(doc,start);
}else{
SwingUtilities.invokeLater(newColouringTask(doc,start,1,normalStyle));
++start;
}
}
}
/
***对åè¯è¿è¡çè²,并è¿ååè¯ç»æçä¸æ .
*
*@paramdoc
*@parampos
*@return
*@throwsBadLocationException
*/
publicintcolouringWord(StyledDocumentdoc,intpos)throwsBadLocationException{
intwordEnd=indexOfWordEnd(doc,pos);
Stringword=doc.getText(pos,wordEnd-pos);
if(keywords.contains(word)){
//å¦ææ¯å ³é®å,å°±è¿è¡å ³é®åççè²,å¦å使ç¨æ®éççè².
//è¿éæä¸ç¹è¦æ³¨æ,å¨insertUpdateåremoveUpdateçæ¹æ³è°ç¨çè¿ç¨ä¸,ä¸è½ä¿®æ¹docçå±æ§.
//ä½æ们åè¦è¾¾å°è½å¤ä¿®æ¹docçå±æ§,æ以ææ¤ä»»å¡æ¾å°è¿ä¸ªæ¹æ³çå¤é¢å»æ§è¡.
//å®ç°è¿ä¸ç®ç,å¯ä»¥ä½¿ç¨æ°çº¿ç¨,ä½æ¾å°swingçäºä»¶éåéå»å¤çæ´è½»ä¾¿ä¸ç¹.
SwingUtilities.invokeLater(newColouringTask(doc,pos,wordEnd-pos,keywordStyle));
}else{
SwingUtilities.invokeLater(newColouringTask(doc,pos,wordEnd-pos,normalStyle));
}
returnwordEnd;
}
/
**CEAC1CEEE2CA9BDFC
å¯è½æ¯ç±»ä¼¼äºmd5çå å¯ç®æ³
---------------
md5çå ¨ç§°æ¯message-digest algorithm 5ï¼ä¿¡æ¯-æè¦ç®æ³ï¼ï¼å¨å¹´ä»£åç±mit laboratory for computer scienceårsa data security incçronald l. rivestå¼ååºæ¥ï¼ç»md2ãmd3åmd4åå±èæ¥ãå®çä½ç¨æ¯è®©å¤§å®¹éä¿¡æ¯å¨ç¨æ°åç¾å软件ç¾ç½²ç§äººå¯åå被"å缩"æä¸ç§ä¿å¯çæ ¼å¼ï¼å°±æ¯æä¸ä¸ªä»»æé¿åº¦çåè串åæ¢æä¸å®é¿ç大æ´æ°ï¼ãä¸ç®¡æ¯md2ãmd4è¿æ¯md5ï¼å®ä»¬é½éè¦è·å¾ä¸ä¸ªéæºé¿åº¦çä¿¡æ¯å¹¶äº§çä¸ä¸ªä½çä¿¡æ¯æè¦ãè½ç¶è¿äºç®æ³çç»ææå¤æå°æäºç¸ä¼¼ï¼ä½md2ç设计ä¸md4åmd5å®å ¨ä¸åï¼é£æ¯å 为md2æ¯ä¸º8ä½æºå¨åè¿è®¾è®¡ä¼åçï¼èmd4åmd5å´æ¯é¢åä½ççµèãè¿ä¸ä¸ªç®æ³çæè¿°åcè¯è¨æºä»£ç å¨internet rfcs ä¸æ详ç»çæè¿°ï¼h++p://www.ietf.org/rfc/rfc.txtï¼ï¼è¿æ¯ä¸ä»½ææå¨çææ¡£ï¼ç±ronald l. rivestå¨å¹´8æåieftæ交ã
rivestå¨å¹´å¼ååºmd2ç®æ³ãå¨è¿ä¸ªç®æ³ä¸ï¼é¦å 对信æ¯è¿è¡æ°æ®è¡¥ä½ï¼ä½¿ä¿¡æ¯çåèé¿åº¦æ¯çåæ°ãç¶åï¼ä»¥ä¸ä¸ªä½çæ£éªå追å å°ä¿¡æ¯æ«å°¾ã并ä¸æ ¹æ®è¿ä¸ªæ°äº§ççä¿¡æ¯è®¡ç®åºæ£åå¼ãåæ¥ï¼rogieråchauvaudåç°å¦æ忽ç¥äºæ£éªåå°äº§çmd2å²çªãmd2ç®æ³çå å¯åç»ææ¯å¯ä¸ç--æ¢æ²¡æéå¤ã
为äºå 强ç®æ³çå®å ¨æ§ï¼rivestå¨å¹´åå¼ååºmd4ç®æ³ãmd4ç®æ³åæ ·éè¦å¡«è¡¥ä¿¡æ¯ä»¥ç¡®ä¿ä¿¡æ¯çåèé¿åº¦å ä¸åè½è¢«æ´é¤ï¼ä¿¡æ¯åèé¿åº¦mod = ï¼ãç¶åï¼ä¸ä¸ªä»¥ä½äºè¿å¶è¡¨ç¤ºçä¿¡æ¯çæåé¿åº¦è¢«æ·»å è¿æ¥ãä¿¡æ¯è¢«å¤çæä½damg?rd/merkleè¿ä»£ç»æçåºåï¼èä¸æ¯ä¸ªåºåè¦éè¿ä¸ä¸ªä¸åæ¥éª¤çå¤çãden boeråbosselaers以åå ¶ä»äººå¾å¿«çåç°äºæ»å»md4çæ¬ä¸ç¬¬ä¸æ¥å第ä¸æ¥çæ¼æ´ãdobbertinå大家æ¼ç¤ºäºå¦ä½å©ç¨ä¸é¨æ®éç个人çµèå¨å åéå æ¾å°md4å®æ´çæ¬ä¸çå²çªï¼è¿ä¸ªå²çªå®é ä¸æ¯ä¸ç§æ¼æ´ï¼å®å°å¯¼è´å¯¹ä¸åçå 容è¿è¡å å¯å´å¯è½å¾å°ç¸åçå å¯åç»æï¼ã毫æ çé®ï¼md4å°±æ¤è¢«æ·æ±°æäºã
尽管md4ç®æ³å¨å®å ¨ä¸æ个è¿ä¹å¤§çæ¼æ´ï¼ä½å®å¯¹å¨å ¶åæ被å¼ååºæ¥ç好å ç§ä¿¡æ¯å®å ¨å å¯ç®æ³çåºç°å´æçä¸å¯å¿½è§çå¼å¯¼ä½ç¨ãé¤äºmd5以å¤ï¼å ¶ä¸æ¯è¾æåçè¿æsha-1ãripe-md以åhavalçã
ä¸å¹´ä»¥åï¼å³å¹´ï¼rivestå¼ååºææ¯ä¸æ´ä¸ºè¶è¿æççmd5ç®æ³ãå®å¨md4çåºç¡ä¸å¢å äº"å®å ¨-带å"ï¼safety-beltsï¼çæ¦å¿µãè½ç¶md5æ¯md4ç¨å¾®æ ¢ä¸äºï¼ä½å´æ´ä¸ºå®å ¨ãè¿ä¸ªç®æ³å¾ææ¾çç±å个åmd4设计æå°è®¸ä¸åçæ¥éª¤ç»æãå¨md5ç®æ³ä¸ï¼ä¿¡æ¯-æè¦ç大å°åå¡«å çå¿ è¦æ¡ä»¶ä¸md4å®å ¨ç¸åãden boeråbosselaersæ¾åç°md5ç®æ³ä¸çåå²çªï¼pseudo-collisionsï¼ï¼ä½é¤æ¤ä¹å¤å°±æ²¡æå ¶ä»è¢«åç°çå å¯åç»æäºã
van oorschotåwieneræ¾ç»èèè¿ä¸ä¸ªå¨æ£åä¸æ´åæ寻å²çªçå½æ°ï¼brute-force hash functionï¼ï¼èä¸ä»ä»¬çæµä¸ä¸ªè¢«è®¾è®¡ä¸é¨ç¨æ¥æç´¢md5å²çªçæºå¨ï¼è¿å°æºå¨å¨å¹´çå¶é ææ¬å¤§çº¦æ¯ä¸ç¾ä¸ç¾å ï¼å¯ä»¥å¹³åæ¯å¤©å°±æ¾å°ä¸ä¸ªå²çªãä½åä»å¹´å°å¹´è¿å¹´é´ï¼ç«æ²¡æåºç°æ¿ä»£md5ç®æ³çmd6æ被å«åå ¶ä»ä»ä¹ååçæ°ç®æ³è¿ä¸ç¹ï¼æ们就å¯ä»¥çåºè¿ä¸ªççµå¹¶æ²¡æ太å¤çå½±åmd5çå®å ¨æ§ãä¸é¢ææè¿äºé½ä¸è¶³ä»¥æ为md5çå¨å®é åºç¨ä¸çé®é¢ã并ä¸ï¼ç±äºmd5ç®æ³ç使ç¨ä¸éè¦æ¯ä»ä»»ä½çæè´¹ç¨çï¼æ以å¨ä¸è¬çæ åµä¸ï¼éç»å¯åºç¨é¢åãä½å³ä¾¿æ¯åºç¨å¨ç»å¯é¢åå ï¼md5ä¹ä¸å¤±ä¸ºä¸ç§é常ä¼ç§çä¸é´ææ¯ï¼ï¼md5æä¹é½åºè¯¥ç®å¾ä¸æ¯é常å®å ¨çäºã
ç®æ³çåºç¨
md5çå ¸ååºç¨æ¯å¯¹ä¸æ®µä¿¡æ¯ï¼messageï¼äº§çä¿¡æ¯æè¦ï¼message-digestï¼ï¼ä»¥é²æ¢è¢«ç¯¡æ¹ãæ¯å¦ï¼å¨unixä¸æå¾å¤è½¯ä»¶å¨ä¸è½½çæ¶åé½æä¸ä¸ªæ件åç¸åï¼æ件æ©å±å为.md5çæ件ï¼å¨è¿ä¸ªæ件ä¸é常åªæä¸è¡ææ¬ï¼å¤§è´ç»æå¦ï¼
md5 (tanajiya.tar.gz) = 0cab9c0fade
è¿å°±æ¯tanajiya.tar.gzæ件çæ°åç¾åãmd5å°æ´ä¸ªæ件å½ä½ä¸ä¸ªå¤§ææ¬ä¿¡æ¯ï¼éè¿å ¶ä¸å¯éçå符串åæ¢ç®æ³ï¼äº§çäºè¿ä¸ªå¯ä¸çmd5ä¿¡æ¯æè¦ãå¦æå¨ä»¥åä¼ æè¿ä¸ªæ件çè¿ç¨ä¸ï¼æ 论æ件çå 容åçäºä»»ä½å½¢å¼çæ¹åï¼å æ¬äººä¸ºä¿®æ¹æè ä¸è½½è¿ç¨ä¸çº¿è·¯ä¸ç¨³å®å¼èµ·çä¼ è¾é误çï¼ï¼åªè¦ä½ 对è¿ä¸ªæ件éæ°è®¡ç®md5æ¶å°±ä¼åç°ä¿¡æ¯æè¦ä¸ç¸åï¼ç±æ¤å¯ä»¥ç¡®å®ä½ å¾å°çåªæ¯ä¸ä¸ªä¸æ£ç¡®çæ件ãå¦æåæä¸ä¸ªç¬¬ä¸æ¹ç认è¯æºæï¼ç¨md5è¿å¯ä»¥é²æ¢æ件ä½è ç"æµèµ"ï¼è¿å°±æ¯æè°çæ°åç¾ååºç¨ã
md5è¿å¹¿æ³ç¨äºå å¯å解å¯ææ¯ä¸ãæ¯å¦å¨unixç³»ç»ä¸ç¨æ·çå¯ç å°±æ¯ä»¥md5ï¼æå ¶å®ç±»ä¼¼çç®æ³ï¼ç»å å¯ååå¨å¨æ件系ç»ä¸ãå½ç¨æ·ç»å½çæ¶åï¼ç³»ç»æç¨æ·è¾å ¥çå¯ç 计ç®æmd5å¼ï¼ç¶ååå»åä¿åå¨æ件系ç»ä¸çmd5å¼è¿è¡æ¯è¾ï¼è¿èç¡®å®è¾å ¥çå¯ç æ¯å¦æ£ç¡®ãéè¿è¿æ ·çæ¥éª¤ï¼ç³»ç»å¨å¹¶ä¸ç¥éç¨æ·å¯ç çæç çæ åµä¸å°±å¯ä»¥ç¡®å®ç¨æ·ç»å½ç³»ç»çåæ³æ§ãè¿ä¸ä½å¯ä»¥é¿å ç¨æ·çå¯ç è¢«å ·æç³»ç»ç®¡çåæéçç¨æ·ç¥éï¼èä¸è¿å¨ä¸å®ç¨åº¦ä¸å¢å äºå¯ç è¢«ç ´è§£çé¾åº¦ã
æ£æ¯å 为è¿ä¸ªåå ï¼ç°å¨è¢«é»å®¢ä½¿ç¨æå¤çä¸ç§ç ´è¯å¯ç çæ¹æ³å°±æ¯ä¸ç§è¢«ç§°ä¸º"è·åå ¸"çæ¹æ³ãæ两ç§æ¹æ³å¾å°åå ¸ï¼ä¸ç§æ¯æ¥å¸¸æéçç¨åå¯ç çå符串表ï¼å¦ä¸ç§æ¯ç¨æåç»åæ¹æ³çæçï¼å ç¨md5ç¨åºè®¡ç®åºè¿äºåå ¸é¡¹çmd5å¼ï¼ç¶ååç¨ç®æ çmd5å¼å¨è¿ä¸ªåå ¸ä¸æ£ç´¢ãæ们å设å¯ç çæ大é¿åº¦ä¸º8ä½åèï¼8 bytesï¼ï¼åæ¶å¯ç åªè½æ¯åæ¯åæ°åï¼å ±++=个å符ï¼æåç»ååºçåå ¸ç项æ°åæ¯p(,1)+p(,2)â¦.+p(,8)ï¼é£ä¹å·²ç»æ¯ä¸ä¸ªå¾å¤©æçæ°åäºï¼åå¨è¿ä¸ªåå ¸å°±éè¦tb级çç£çéµåï¼èä¸è¿ç§æ¹æ³è¿æä¸ä¸ªåæï¼å°±æ¯è½è·å¾ç®æ è´¦æ·çå¯ç md5å¼çæ åµä¸æå¯ä»¥ãè¿ç§å å¯ææ¯è¢«å¹¿æ³çåºç¨äºunixç³»ç»ä¸ï¼è¿ä¹æ¯ä¸ºä»ä¹unixç³»ç»æ¯ä¸è¬æä½ç³»ç»æ´ä¸ºååºä¸ä¸ªéè¦åå ã
ç®æ³æè¿°
对md5ç®æ³ç®è¦çåè¿°å¯ä»¥ä¸ºï¼md5以ä½åç»æ¥å¤çè¾å ¥çä¿¡æ¯ï¼ä¸æ¯ä¸åç»å被åå为个ä½ååç»ï¼ç»è¿äºä¸ç³»åçå¤çåï¼ç®æ³çè¾åºç±å个ä½åç»ç»æï¼å°è¿å个ä½åç»çº§èåå°çæä¸ä¸ªä½æ£åå¼ã
å¨md5ç®æ³ä¸ï¼é¦å éè¦å¯¹ä¿¡æ¯è¿è¡å¡«å ï¼ä½¿å ¶åèé¿åº¦å¯¹æ±ä½çç»æçäºãå æ¤ï¼ä¿¡æ¯çåèé¿åº¦ï¼bits lengthï¼å°è¢«æ©å±è³n*+ï¼å³n*+个åèï¼bytesï¼ï¼n为ä¸ä¸ªæ£æ´æ°ãå¡«å çæ¹æ³å¦ä¸ï¼å¨ä¿¡æ¯çåé¢å¡«å ä¸ä¸ª1åæ æ°ä¸ª0ï¼ç´å°æ»¡è¶³ä¸é¢çæ¡ä»¶æ¶æåæ¢ç¨0对信æ¯çå¡«å ãç¶åï¼å¨å¨è¿ä¸ªç»æåé¢éå ä¸ä¸ªä»¥ä½äºè¿å¶è¡¨ç¤ºçå¡«å åä¿¡æ¯é¿åº¦ãç»è¿è¿ä¸¤æ¥çå¤çï¼ç°å¨çä¿¡æ¯åèé¿åº¦=n*++=(n+1)*ï¼å³é¿åº¦æ°å¥½æ¯çæ´æ°åãè¿æ ·åçåå æ¯ä¸ºæ»¡è¶³åé¢å¤çä¸å¯¹ä¿¡æ¯é¿åº¦çè¦æ±ã
md5ä¸æå个ä½è¢«ç§°ä½é¾æ¥åéï¼chaining variableï¼çæ´æ°åæ°ï¼ä»ä»¬åå«ä¸ºï¼a=0xï¼b=0xabcdefï¼c=0xfedcbaï¼d=0xã
å½è®¾ç½®å¥½è¿å个é¾æ¥åéåï¼å°±å¼å§è¿å ¥ç®æ³çå轮循ç¯è¿ç®ã循ç¯ç次æ°æ¯ä¿¡æ¯ä¸ä½ä¿¡æ¯åç»çæ°ç®ã
å°ä¸é¢å个é¾æ¥åéå¤å¶å°å¦å¤å个åéä¸ï¼aå°aï¼bå°bï¼cå°cï¼då°dã
主循ç¯æåè½®ï¼md4åªæä¸è½®ï¼ï¼æ¯è½®å¾ªç¯é½å¾ç¸ä¼¼ã第ä¸è½®è¿è¡æ¬¡æä½ãæ¯æ¬¡æä½å¯¹aãbãcådä¸çå ¶ä¸ä¸ä¸ªä½ä¸æ¬¡é线æ§å½æ°è¿ç®ï¼ç¶åå°æå¾ç»æå ä¸ç¬¬å个åéï¼ææ¬çä¸ä¸ªååç»åä¸ä¸ªå¸¸æ°ãåå°æå¾ç»æåå³ç¯ç§»ä¸ä¸ªä¸å®çæ°ï¼å¹¶å ä¸aãbãcædä¸ä¹ä¸ãæåç¨è¯¥ç»æå代aãbãcædä¸ä¹ä¸ã
以ä¸ä¸æ¯æ¯æ¬¡æä½ä¸ç¨å°çå个é线æ§å½æ°ï¼æ¯è½®ä¸ä¸ªï¼ã
f(x,y,z) =(x&y)|((~x)&z)
g(x,y,z) =(x&z)|(y&(~z))
h(x,y,z) =x^y^z
i(x,y,z)=y^(x|(~z))
ï¼&æ¯ä¸ï¼|æ¯æï¼~æ¯éï¼^æ¯å¼æï¼
è¿å个å½æ°ç说æï¼å¦æxãyåzç对åºä½æ¯ç¬ç«åååçï¼é£ä¹ç»æçæ¯ä¸ä½ä¹åºæ¯ç¬ç«åååçã
fæ¯ä¸ä¸ªéä½è¿ç®çå½æ°ãå³ï¼å¦æxï¼é£ä¹yï¼å¦åzãå½æ°hæ¯éä½å¥å¶æä½ç¬¦ã
å设mj表示æ¶æ¯ç第j个ååç»ï¼ä»0å°ï¼ï¼<<
ff(a,b,c,d,mj,s,ti)表示a=b+((a+(f(b,c,d)+mj+ti)<< gg(a,b,c,d,mj,s,ti)表示a=b+((a+(g(b,c,d)+mj+ti)<< hh(a,b,c,d,mj,s,ti)表示a=b+((a+(h(b,c,d)+mj+ti)<< ii(a,b,c,d,mj,s,ti)表示a=b+((a+(i(b,c,d)+mj+ti)<<
è¿åè½®ï¼æ¥ï¼æ¯ï¼
第ä¸è½®
ff(a,b,c,d,m0,7,0xdaa)
ff(d,a,b,c,m1,,0xe8c7b)
ff(c,d,a,b,m2,,0xdb)
ff(b,c,d,a,m3,,0xc1bdceee)
ff(a,b,c,d,m4,7,0xfc0faf)
ff(d,a,b,c,m5,,0xca)
ff(c,d,a,b,m6,,0xa)
ff(b,c,d,a,m7,,0xfd)
ff(a,b,c,d,m8,7,0xd8)
ff(d,a,b,c,m9,,0x8bf7af)
ff(c,d,a,b,m,,0xffff5bb1)
ff(b,c,d,a,m,,0xcd7be)
ff(a,b,c,d,m,7,0x6b)
ff(d,a,b,c,m,,0xfd)
ff(c,d,a,b,m,,0xae)
ff(b,c,d,a,m,,0xb)
第äºè½®
gg(a,b,c,d,m1,5,0xfe)
gg(d,a,b,c,m6,9,0xcb)
gg(c,d,a,b,m,,0xe5a)
gg(b,c,d,a,m0,,0xe9b6c7aa)
gg(a,b,c,d,m5,5,0xdfd)
gg(d,a,b,c,m,9,0x)
gg(c,d,a,b,m,,0xd8a1e)
gg(b,c,d,a,m4,,0xe7d3fbc8)
gg(a,b,c,d,m9,5,0xe1cde6)
gg(d,a,b,c,m,9,0xcd6)
gg(c,d,a,b,m3,,0xf4dd)
gg(b,c,d,a,m8,,0xaed)
gg(a,b,c,d,m,5,0xa9e3e)
gg(d,a,b,c,m2,9,0xfcefa3f8)
gg(c,d,a,b,m7,,0xfd9)
gg(b,c,d,a,m,,0x8d2a4c8a)
第ä¸è½®
hh(a,b,c,d,m5,4,0xfffa)
hh(d,a,b,c,m8,,0xf)
hh(c,d,a,b,m,,0x6d9d)
hh(b,c,d,a,m,,0xfdec)
hh(a,b,c,d,m1,4,0xa4beea)
hh(d,a,b,c,m4,,0x4bdecfa9)
hh(c,d,a,b,m7,,0xf6bb4b)
hh(b,c,d,a,m,,0xbebfbc)
hh(a,b,c,d,m,4,0xb7ec6)
hh(d,a,b,c,m0,,0xeaafa)
hh(c,d,a,b,m3,,0xd4ef)
hh(b,c,d,a,m6,,0xd)
hh(a,b,c,d,m9,4,0xd9d4d)
hh(d,a,b,c,m,,0xe6dbe5)
hh(c,d,a,b,m,,0x1facf8)
hh(b,c,d,a,m2,,0xc4ac)
第åè½®
ii(a,b,c,d,m0,6,0xf)
ii(d,a,b,c,m7,,0xaff)
ii(c,d,a,b,m,,0xaba7)
ii(b,c,d,a,m5,,0xfca)
ii(a,b,c,d,m,6,0xbc3)
ii(d,a,b,c,m3,,0x8f0ccc)
ii(c,d,a,b,m,,0xffeffd)
ii(b,c,d,a,m1,,0xdd1)
ii(a,b,c,d,m8,6,0x6fae4f)
ii(d,a,b,c,m,,0xfe2ce6e0)
ii(c,d,a,b,m6,,0xa)
ii(b,c,d,a,m,,0x4ea1)
ii(a,b,c,d,m4,6,0xfe)
ii(d,a,b,c,m,,0xbd3af)
ii(c,d,a,b,m2,,0x2ad7d2bb)
ii(b,c,d,a,m9,,0xebd)
常æ°tiå¯ä»¥å¦ä¸éæ©ï¼
å¨ç¬¬iæ¥ä¸ï¼tiæ¯*abs(sin(i))çæ´æ°é¨åï¼içåä½æ¯å¼§åº¦ã(çäº2ç次æ¹)
ææè¿äºå®æä¹åï¼å°aãbãcãdåå«å ä¸aãbãcãdãç¶åç¨ä¸ä¸åç»æ°æ®ç»§ç»è¿è¡ç®æ³ï¼æåçè¾åºæ¯aãbãcådç级èã
å½ä½ æç §æä¸é¢æ说çæ¹æ³å®ç°md5ç®æ³ä»¥åï¼ä½ å¯ä»¥ç¨ä»¥ä¸å 个信æ¯å¯¹ä½ ååºæ¥çç¨åºä½ä¸ä¸ªç®åçæµè¯ï¼ççç¨åºæ没æé误ã
md5 ("") = dd8cdfbeecfe
md5 ("a") = 0ccb9c0f1b6ace
md5 ("abc") = cdfb0df7def
md5 ("message digest") = fbd7cbda2faafd0
md5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3dedfbccaeb
md5 ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz") =
dabdd9f5ac2c9fd9f
md5 ("
") = edf4abe3cacda2eba
å¦æä½ ç¨ä¸é¢çä¿¡æ¯åå«å¯¹ä½ åçmd5ç®æ³å®ä¾åæµè¯ï¼æåå¾åºçç»è®ºåæ åçæ¡å®å ¨ä¸æ ·ï¼é£æå°±è¦å¨è¿éè±¡ä½ éä¸å£°ç¥è´ºäºãè¦ç¥éï¼æçç¨åºå¨ç¬¬ä¸æ¬¡ç¼è¯æåçæ¶åæ¯æ²¡æå¾åºåä¸é¢ç¸åçç»æçã
md5çå®å ¨æ§
md5ç¸å¯¹md4æä½çæ¹è¿ï¼
1. å¢å äºç¬¬åè½®ï¼
2. æ¯ä¸æ¥åæå¯ä¸çå æ³å¸¸æ°ï¼
3. 为å弱第äºè½®ä¸å½æ°gç对称æ§ä»(x&y)|(x&z)|(y&z)å为(x&z)|(y&(~z))ï¼
4. 第ä¸æ¥å ä¸äºä¸ä¸æ¥çç»æï¼è¿å°å¼èµ·æ´å¿«çéªå´©æåºï¼
5. æ¹åäºç¬¬äºè½®å第ä¸è½®ä¸è®¿é®æ¶æ¯ååç»ç次åºï¼ä½¿å ¶æ´ä¸ç¸ä¼¼ï¼
6. è¿ä¼¼ä¼åäºæ¯ä¸è½®ä¸ç循ç¯å·¦ç§»ä½ç§»é以å®ç°æ´å¿«çéªå´©æåºãåè½®çä½ç§»éäºä¸ç¸åã
[color=red]ç®åç说ï¼
MD5å«ä¿¡æ¯ï¼æè¦ç®æ³ï¼æ¯ä¸ç§å¯ç çç®æ³ï¼å®å¯ä»¥å¯¹ä»»ä½æ件产çä¸ä¸ªå¯ä¸çMD5éªè¯ç ï¼æ¯ä¸ªæ件çMD5ç å°±å¦åæ¯ä¸ªäººçæ纹ä¸æ ·ï¼é½æ¯ä¸åçï¼è¿æ ·ï¼ä¸æ¦è¿ä¸ªæ件å¨ä¼ è¾è¿ç¨ä¸ï¼å ¶å 容被æåæè 被修æ¹çè¯ï¼é£ä¹è¿ä¸ªæ件çMD5ç å°±ä¼åçååï¼éè¿å¯¹æ件MD5çéªè¯ï¼å¯ä»¥å¾ç¥è·å¾çæ件æ¯å¦å®æ´ã