tommykent1210
Member
- Joined
- Nov 2, 2011
- Messages
- 10
- Programming Experience
- 1-3
Hi there, I am making a library for vb.NET that makes it easy for me to use hashing methods in my other projects, without having to write the same code over and over again in different projects.
I have a function named "ReturnHash". This has 2 versions like so:
There needs to be 2 versions, because some hashing methods do not need to support salting. So, I want to overload it. If MD5/SHA-X/RIPEMD are selected form intellisense, then the first function is called, if not the second is.
Now, this works (kind of), because when I call the method ReturnHash() I can put the value I want for the enum in and it switches to the correct function. BUT, the enum values DO NOT appear in the intellisense window :S Until I type "MyLibrary.NonSaltingMethod." the optons do not appear. Is there any way to make all possible options appear, then switch to the correct function after the method is slected? I tried putting them all in one function, but if they are in the same, the "Optional" salt parameters appear even if CRC32 is selected :S
Thanks In Advance
Tom
I have a function named "ReturnHash". This has 2 versions like so:
Public Enum Method MD5 = 0 SHA1 = 1 SHA256 = 2 SHA512 = 3 RIPEMD_160 = 4 End Enum Public Enum NonSaltMethod CRC_32 = 0 End Enum 'then Public Overloads Function ReturnHash(ByVal Message As String, ByVal Method As Method, Optional ByVal SaltingType As SaltingType = SaltingType.None, Optional ByVal Salt As String = "") 'Do some stuff End Function Public Overloads Function ReturnHash(ByVal Message As String, ByVal Method As NonSaltMethod) 'Do some other stuff End Function
There needs to be 2 versions, because some hashing methods do not need to support salting. So, I want to overload it. If MD5/SHA-X/RIPEMD are selected form intellisense, then the first function is called, if not the second is.
Now, this works (kind of), because when I call the method ReturnHash() I can put the value I want for the enum in and it switches to the correct function. BUT, the enum values DO NOT appear in the intellisense window :S Until I type "MyLibrary.NonSaltingMethod." the optons do not appear. Is there any way to make all possible options appear, then switch to the correct function after the method is slected? I tried putting them all in one function, but if they are in the same, the "Optional" salt parameters appear even if CRC32 is selected :S
Thanks In Advance
Tom