Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Languages, Compilers, Interpreters > Algorithms
Register

Reply
 
LinkBack Thread Tools
Old 09.09.2008, 18:12   #1
Академик
 
Join Date: 01 2002
Location: Shambala
Age: 38
Posts: 7,015
Downloads: 11
Uploads: 0
Reputation: 267 | 5
Default C# Des 3DES

Txner uremn C++ ov ka realizacvac 3DES i inch vor mi algoritm vor vor

hello (unicode darcrac)

encrypt a anum u stacvuma hetevyal Byte Array

0D:59:00:EA:7F:7C:1E:91:FF:E7:B6:066:71:C1:A2

hima porcum em nuyn ban grel C# ov ogtvelov arden goyutyun unecox TripleDES i class eric funkcianeric TripleDESCryptoServiceProvider i mej exac

asem vor voch mi dzev chem karum hello ic edi stanam

IV dnum em {0,0,0,0,0,0,0,0} kam ndhnarapes null ECB (electronic code book ) ov porcelu hamar u eli chi kpnum


hetaqrqirn ena vor yete masnatem string 4 hat characterneri (xosqi "hell" u "o" ) apa unicode darcneluc u encode aneluc heto kstanam

amen mi 8 byte anoc bloki hamar( "hello" i u "o" el verjum '0xff' avelacrac) uremn es amen mi 8 byte anoc bloki hamar stanum em 16 byte ardyunq vori arajin 8 byte chisht u chisht hamnknuma henc eeeeeeeeeeeeeeeeeeeeen


c++ ovi ardyunqi het

nd vorum porcum em yev urish input string erov es senca, bayc de ho chem kara ed amen bloki encoded 16 byte ic verji 8 qcem ?


yete nuynisk tenc anem arden DECODE chem kara anem

xorhurd ktaq txeq vonc anem ?

npatak mekna encode anel 3DES ov hello u stanal verevum nshvac Byte array

es 2 ora gluxs urav

hetaqrqirn ena vor yete porcem
__________________
Ախպեր դու էմիգրացիան տուրիզմի հետ մի խառնի...

http://moskull.livejournal.com/
Reply With Quote
Old 11.09.2008, 16:31   #2
Школьник
 
Fox's Avatar
 
Join Date: 11 2005
Location: AM
Posts: 178
Downloads: 0
Uploads: 0
Reputation: 15 | 3
Default

Encrypti orinak -
ConvertHexStringToByteArray funkcian petqa grel inqnuruin
kam ogtagorcel standart funkcianer

private string sk = "B51CFD05E333882F1F96F3B0121FDE0FDF9ED5A1B25C8C2D";
private string siv = "A29D41CEAE072F6F";
private byte[] k;
private byte[] iv;
k = new byte[sk.Length/2];
iv = new byte[siv.Length/2];

k = ConvertHexStringToByteArray(sk);
iv = ConvertHexStringToByteArray(siv);

byte[] eHello;
SymmetricAlgorithm cp = new TripleDESCryptoServiceProvider();

ICryptoTransform ct;

ct = cp.CreateEncryptor(k, iv);

System.IO.MemoryStream ms = new System.IO.MemoryStream();
CryptoStream cs = new CryptoStream(ms, ct, CryptoStreamMode.Write);

cs.Write(Encoding.UTF8.GetBytes("HELLO"), 0, Encoding.UTF8.GetBytes("HELLO").Length);
cs.FlushFinalBlock();
eHello = new byte[ms.Length];

ms.Seek(0, System.IO.SeekOrigin.Begin);
ms.Read(eHello, 0, eHello.Length);

cs.Close();
ms.Close();


eHello-n klini qo [email protected]

hanelem im ashkhatokh koderic
__________________
Если в слове "жена" сделать 4 ошибки, получится "пиво"

{Barracuda} Online Intellectual Games Club
http://www.Explorer.am - Explore Armenia!
Reply With Quote
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 14:00.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.