Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Aug 19, 2026
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Aug 18, 2026
🎬 CapCut Pro 1 Month Access! LKR 600
sayuru bandara
Updated:
Aug 18, 2026
🚀 Google One AI PRO Plan (Gemini Pro Activation) – 18 Months Access! LKR 2200
sayuru bandara
Updated:
Aug 18, 2026
Canva Pro Lifetime Own Mail Activation LKR 500
sayuru bandara
Updated:
Aug 18, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
C# Encryption
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="EGhewg5" data-source="post: 23491246" data-attributes="member: 567887"><p>Machan large file ekak (2GB) encypt & decypt karanna thiyana fastma (Performance) widiya mokadda...?</p><p></p><p>Mama danata stackoverflow eke thibila me code eka try kara. Eke performance madiyi.</p><p></p><p>[CODE]</p><p>private static void EncryptFile(string inputFile, string outputFile)</p><p> {</p><p></p><p> try</p><p> {</p><p> string password = @"myKey123"; // Your Key Here</p><p> UnicodeEncoding UE = new UnicodeEncoding();</p><p> byte[] key = UE.GetBytes(password);</p><p></p><p> string cryptFile = outputFile;</p><p> FileStream fsCrypt = new FileStream(cryptFile, FileMode.Create);</p><p></p><p> RijndaelManaged RMCrypto = new RijndaelManaged();</p><p></p><p> CryptoStream cs = new CryptoStream(fsCrypt,</p><p> RMCrypto.CreateEncryptor(key, key),</p><p> CryptoStreamMode.Write);</p><p></p><p> FileStream fsIn = new FileStream(inputFile, FileMode.Open);</p><p></p><p> int data;</p><p> while ((data = fsIn.ReadByte()) != -1)</p><p> cs.WriteByte((byte)data);</p><p></p><p></p><p> fsIn.Close();</p><p> cs.Close();</p><p> fsCrypt.Close();</p><p></p><p> Console.WriteLine("Encryption Done!");</p><p> }</p><p> catch</p><p> {</p><p> Console.WriteLine("Encryption failed!");</p><p> }</p><p> }</p><p></p><p> private static void DecryptFile(string inputFile, string outputFile)</p><p> {</p><p></p><p> {</p><p> string password = @"myKey123"; // Your Key Here</p><p></p><p> UnicodeEncoding UE = new UnicodeEncoding();</p><p> byte[] key = UE.GetBytes(password);</p><p></p><p> FileStream fsCrypt = new FileStream(inputFile, FileMode.Open);</p><p></p><p> RijndaelManaged RMCrypto = new RijndaelManaged();</p><p></p><p> CryptoStream cs = new CryptoStream(fsCrypt,</p><p> RMCrypto.CreateDecryptor(key, key),</p><p> CryptoStreamMode.Read);</p><p></p><p> FileStream fsOut = new FileStream(outputFile, FileMode.Create);</p><p></p><p> int data;</p><p> while ((data = cs.ReadByte()) != -1)</p><p> fsOut.WriteByte((byte)data);</p><p></p><p> fsOut.Close();</p><p> cs.Close();</p><p> fsCrypt.Close();</p><p></p><p> Console.WriteLine("Decription Done!");</p><p> }</p><p> }</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="EGhewg5, post: 23491246, member: 567887"] Machan large file ekak (2GB) encypt & decypt karanna thiyana fastma (Performance) widiya mokadda...? Mama danata stackoverflow eke thibila me code eka try kara. Eke performance madiyi. [CODE] private static void EncryptFile(string inputFile, string outputFile) { try { string password = @"myKey123"; // Your Key Here UnicodeEncoding UE = new UnicodeEncoding(); byte[] key = UE.GetBytes(password); string cryptFile = outputFile; FileStream fsCrypt = new FileStream(cryptFile, FileMode.Create); RijndaelManaged RMCrypto = new RijndaelManaged(); CryptoStream cs = new CryptoStream(fsCrypt, RMCrypto.CreateEncryptor(key, key), CryptoStreamMode.Write); FileStream fsIn = new FileStream(inputFile, FileMode.Open); int data; while ((data = fsIn.ReadByte()) != -1) cs.WriteByte((byte)data); fsIn.Close(); cs.Close(); fsCrypt.Close(); Console.WriteLine("Encryption Done!"); } catch { Console.WriteLine("Encryption failed!"); } } private static void DecryptFile(string inputFile, string outputFile) { { string password = @"myKey123"; // Your Key Here UnicodeEncoding UE = new UnicodeEncoding(); byte[] key = UE.GetBytes(password); FileStream fsCrypt = new FileStream(inputFile, FileMode.Open); RijndaelManaged RMCrypto = new RijndaelManaged(); CryptoStream cs = new CryptoStream(fsCrypt, RMCrypto.CreateDecryptor(key, key), CryptoStreamMode.Read); FileStream fsOut = new FileStream(outputFile, FileMode.Create); int data; while ((data = cs.ReadByte()) != -1) fsOut.WriteByte((byte)data); fsOut.Close(); cs.Close(); fsCrypt.Close(); Console.WriteLine("Decription Done!"); } } [/CODE] [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom