|
-
Aug 30th, 2000, 12:59 PM
#1
Thread Starter
Member
say I had a var
dim vHex as string
vHex = "&hhe" 'that's a hex code
vHextoInt = '?? ChangeHextoIntegerFunction ?? (vHex)
and I wanted to stuff it into a byte
dim vByteVar as Byte
vByteVar = Cbyte(vHextoInt)
How do I convert the Hex to Int??
-
Aug 30th, 2000, 01:08 PM
#2
Guru
Just CLng it!
Use CLng!
Code:
lblHex.Caption = CLng("&H12AB") ' Convert hexadecimal "12AB" to an integer
Simple as that!
-
Aug 30th, 2000, 01:18 PM
#3
Thread Starter
Member
hmm.. doesn't like that either
dim vTemp
vTemp = Clng("&h" & Mid(vKey, lCount * 2 + 1, 2))
doesn't fly, not even if you declare vTemp as an Integer
&hhe is a hex code right? or do you need 6 chars??
-
Aug 30th, 2000, 01:26 PM
#4
Well, actually &HHE isn't hex code.
&H means a hexadecimal number will follow. Hexadecimal numbers go from 0 to F. H isn't hex, so HE isn't also.
-
Aug 30th, 2000, 01:42 PM
#5
Thread Starter
Member
That's what I thought
This encryption class is really irritating.
In theory it should be *cake* to use but I keep getting
0 byte files.
I even had it working earlier, I just re-wired the app the wrong way. I was trying to fix it by integrating the hex conversion of the key , which is what a sample frm tried to do but wouldn't compile.
I have sum tweaking to do..
Thanx
-
Aug 30th, 2000, 05:49 PM
#6
So Unbanned
Re: Just CLng it!
Originally posted by Yonatan
Use CLng!
Code:
lblHex.Caption = CLng("&H12AB") ' Convert hexadecimal "12AB" to an integer
Simple as that!
Val("&H12AB")
Would work the same as CLng.
Oh yes, if you're converting characters to Hex I'd reccomend doing:
String2Hex = "Vb-World!"
for x = 1 to len(String2Hex)
NewHexStr = NewHexStr & format(hex$(asc(mid$(String2Hex,x,1))),"##00")
'format is to maintain 2 character hex REQUIRED for chr$(0-9)
next
and to bring it back:
Hex2String = "56622D576F726C6421"
for x = 1 to len(Hex2String) step 2
NewStr = NewStr & chr$(val("&H" & mid$(Hex2String,x,2)))
next x
-
Aug 30th, 2000, 05:59 PM
#7
Thread Starter
Member
I gave up on converting the Key
unfortunately, I can't figure out how much crack the guy was smoking who did the sample form to show me how to use his vbClass
turns out - you need to compile the class into a dll, and then it will do long number addition without screwing it up.. i wasn't doing that.. also, he was trying to stuff
&h with two letters from your key
so if your key was zzzzzzzzzzzzzzzz (16 chars)
the 'hex' code would be &hzz
which doesn't work
so... Clng probably wasn't converting the hex to integer for me for either of those reasons, I'm not sure wether or not I am going to try to emulate what he was doing to the key before setting it as a property
I think he was just basically trying to make the key more complex, but if you mess with the key like that to encrypt it you have to be able to un-mess with it to decrypt and I have way too much stuff to do to try to throw in some extra security on what is already a pretty random 16 byte key and a strong 128 bit encryption.
Phwew
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|