1) fix example

2) add documentation

git-svn-id: svn://kolibrios.org@3330 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2013-03-05 10:14:38 +00:00
parent 1f4b6d494a
commit 0a833519d1
2 changed files with 109 additions and 5 deletions

View File

@ -16,7 +16,7 @@ include '../../../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../../../dll.inc' include '../../../../dll.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db '˜¨ä஢ ­¨¥  «£®à¨â¬®¬ DES 04.03.13',0 ;¯®¤¯¨áì ®ª­  caption db '˜¨ä஢ ­¨¥  «£®à¨â¬®¬ DES 05.03.13',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock struct FileInfoBlock
Function dd ? Function dd ?
@ -136,8 +136,8 @@ pushad
; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) *** ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
xor eax,eax xor eax,eax
mov ebx,(20 shl 16)+485 mov ebx,(20 shl 16)+480
mov ecx,(20 shl 16)+415 mov ecx,(20 shl 16)+410
mov edx,[sc.work] mov edx,[sc.work]
or edx,(3 shl 24)+0x10000000+0x20000000 or edx,(3 shl 24)+0x10000000+0x20000000
mov edi,caption mov edi,caption
@ -275,7 +275,7 @@ but_open_file:
je .end_open_file je .end_open_file
mov [open_file_size],ebx mov [open_file_size],ebx
add ebx,open_file add ebx,dword[open_file]
mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬ mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
mcall 71,1,openfile_path mcall 71,1,openfile_path
@ -601,7 +601,7 @@ align 4
buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 5 ;+4 left dw 5 ;+4 left
dw 31 ;+6 top dw 31 ;+6 top
.w: dd 460 ;+8 w .w: dd 456 ;+8 w
.h: dd 350 ;+12 h .h: dd 350 ;+12 h
.color: dd 0xffffd0 ;+16 color .color: dd 0xffffd0 ;+16 color
db 24 ;+20 bit in pixel db 24 ;+20 bit in pixel

View File

@ -0,0 +1,104 @@
<html>
<head>
<title>áèáëèîòåêà äëÿ øèôðîâàíèÿ ôàéëîâ ïî àëãîðèòìó DES</title>
<meta http-equiv="content-type" content="text/html; charset=WINDOWS-1251">
<style>
body
{
font-size: 15px;
font-family: "Bookman Old Style";
color: black;
text-align: justify;
}
h1 { color: green; font-size: 23px; }
h2 { color: green; font-size: 21px; }
h3 { color: green; font-size: 19px; }
h4 { color: #803f00; font-size: 17px; }
i { color: #0099cc; }
b { color: #0099cc; }
p {
text-indent: 1em;
margin-top: 3px;
margin-bottom: 2px;
margin-left: 0px;
margin-right: 0px;
}
ol, ul, dl{
margin-top: 3px;
margin-bottom: 2px;
}
pre
{
padding: 2px;
padding-left: 20px;
margin-top: 5px;
margin-bottom: 5px;
margin-left: 0px;
margin-right: 0px;
font-family: "Courier New";
font-size: 15px;
color: #004000;
background-color: #ffd0ff;
}
table { font-size: 15px; }
</style>
</head>
<body>
<h1>Îãëàâëåíèå</h1>
<ul>
<li>Âñòóïëåíèå</li>
<li><a href="#fun">Ôóíêöèè</a><br>
<ul>
<li><a href="#f_en">des_encryption</a></li>
<li><a href="#f_de">des_decryption</a></li>
<li><a href="#tabl_e">Òàáëèöà ýêñïîðòà</a></li>
</ul>
<h1>Âñòóïëåíèå</h1>
<p>Áèáëèîòåêà äëÿ øèôðîâàíèÿ ôàéëîâ ïî àëãîðèòìó DES (Data Encryption Standard) — ñèììåòðè÷íûé àëãîðèòì øèôðîâàíèÿ.</p>
<p>Äîêóìåíòàöèÿ îáíîâëÿëàñü 05.03.13.</p>
<h1><a name="fun">Ôóíêöèè</a></h1>
<h4><a name="f_en">des_encryption</a></h4>
<p>Ôóíêöèÿ øèôðîâàíèÿ ôàéëîâ. Ïðèìåð èñïîëüçîâàíèÿ:</p>
<pre>txt_key db 'des_2013',0
mem_key rb 120
...
mov eax,[open_file_size]
shr eax,3
stdcall [des_encryption], txt_key,mem_key,[open_file],eax</pre>
<p>ãäå:</p>
<p><b>txt_key</b> - âõîäíîé êëþ÷ 64 áèò</p>
<p><b>mem_keys</b> - ïàìÿòü äëÿ ôîðìèðîâàíèÿ 16 ïîäêëþ÷åé (ðàçìåð 120 áàéò)</p>
<p><b>[open_file]</b> - óêàçàòåëü íà ïåðâûé øèôðóåìûé 8 áàéòíûé áëîê</p>
<p><b>eax</b> - ÷èñëî áëîêîâ äëÿ øèôðîâàíèÿ (<i>[open_file_size]</i> - ðàçìåð ôàéëà)</p>
<h4><a name="f_de">des_decryption</a></h4>
<p>Ôóíêöèÿ ðàñøèôðîâûâàíèÿ ôàéëîâ. Ïðèìåð èñïîëüçîâàíèÿ:</p>
<pre>txt_key db 'des_2013',0
mem_key rb 120
...
mov eax,[open_file_size]
shr eax,3
stdcall [des_decryption], txt_key,mem_key,[open_file],eax</pre>
<p>ãäå:</p>
<p><b>txt_key</b> - âõîäíîé êëþ÷ 64 áèò</p>
<p><b>mem_keys</b> - ïàìÿòü äëÿ ôîðìèðîâàíèÿ 16 ïîäêëþ÷åé (ðàçìåð 120 áàéò)</p>
<p><b>[open_file]</b> - óêàçàòåëü íà ïåðâûé ðàñøèôðîâûâàåìûé 8 áàéòíûé áëîê</p>
<p><b>eax</b> - ÷èñëî áëîêîâ äëÿ ðàñøèôðîâàíèÿ (<i>[open_file_size]</i> - ðàçìåð ôàéëà)</p>
<h1><a name="tabl_e">Òàáëèöà ýêñïîðòà</a></h1>
<p>Ïðèìåð òàáëèöû ýêñïîðòà, ðàñ÷èòàííîé íà èñïîëüçîâàíèå ìàêðîñà <b>@use_library</b>:</p>
<pre>align 4
import_des:
des_encryption dd sz_des_encryption
des_decryption dd sz_des_decryption
dd 0,0
sz_des_encryption db 'des_encryption',0
sz_des_decryption db 'des_decryption',0</pre>
</body>
</html>