Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MD5 VB.NET code
Message
De
27/01/2014 02:25:35
 
 
À
25/01/2014 11:38:04
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01592356
Message ID:
01592432
Vues:
59
This message has been marked as a message which has helped to the initial question of the thread.
>>I see - not needed imo
>>
>>And the sample code - I'd use USING instead of Close()
>
>That's what I did. :) Every new implementation of such or when I have time to adjust existing code, I am using the Using approach. This is easier, safer, cleaner and handles the memory related issues better.

And also
(1) Dispose() ( or with using) is never called in the example
SHA256Managed derives from HashAlgorithm http://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm(v=vs.110).aspx
            SHA256 mySHA256 = SHA256Managed.Create();
(2) Since the property CanReuseTransform returns true http://msdn.microsoft.com/en-us/library/System.Security.Cryptography.SHA256(v=vs.110).aspx
When you need to calculate the hash for a list of files (as per the example) you can instantiate SHA256Managed only once


Same applies to MD5 or anything else deriving from HashAlgorithm
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform