I've looked around and can't seem to find a simple DES function I can incorporate into my code, a simple one where I can give the string and key (and perhaps salt, although not important to my code right now :-)) and it outputs the encrypted text.
I found VBCrypto, but it's serious overkill with all sorts of other functions built into it and I'm not sure if I would be able to clean out the unimportant code from it to keep it short and sweet.
Has anyone got a simple module or something I can use which lets me call the function and get the data back?
Just to confirm, I want *DES* and not triple-DES, there's tons of triple-DES (3DES) and AES stuff out there, I need DES
Edit: VBCrypto includes class modules that in theory work on their own, but I know nothing at all about using classes in programs, I usually use modules myself...perhaps that is where I need the help :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
As is often the case with this place, much trial and error and messing about on my part yields better results than actually waiting around for assistance :-P
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
A tip for the future - don't edit your posts unless it is just a couple of minutes after you first posted, and you are just making a minor clarification.
If it is any longer (like in this case) and/or the subject changes (like in this case), you should reply instead - that way people will know there is new information since they read it.
I read your initial post (as I suspect many others did in the 70 minutes), but could not help with the issue you had at the time - however I (and many others) could have helped with the new issue you added later, if only we had known it existed.
A tip for the future - don't edit your posts unless it is just a couple of minutes after you first posted, and you are just making a minor clarification.
If it is any longer (like in this case) and/or the subject changes (like in this case), you should reply instead - that way people will know there is new information since they read it.
I read your initial post (as I suspect many others did in the 70 minutes), but could not help with the issue you had at the time - however I (and many others) could have helped with the new issue you added later, if only we had known it existed.
Very true, but I felt at the time that it would have been considered bumping :-)
Technically I still have a problem, but I think this one I have to speak with someone knowledgeable in DES to sort this out...I'm inputting an 8-byte string and getting a 24-byte encrypted string back...I thought DES was supposed to encrypt the string without making it larger?
In a way, a simple DES function (or DLL but I would prefer something I can build into the code) would still be handy and I'd replace the one I am using from VBCrypt with the new one :-)
Edit: I've upped the DES class that came with VBCrypt. If possible, could someone help me find out how to properly encrypt with it so that the output matches the length of the input (8 bytes should become 8 bytes, any block lower than 8 bytes is padded) and give me the information needed to use it either as the class or a module version :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
It's not a bump if you are adding more info, as it shows you are making some sort of progress on your own (whereas a bump is basically trying to get us to do it for you).
In terms of the extra size, I'm not too surprised by that - I would expect some overhead to store the key etc, and I suspect that it will remain at a fairly constant level (so for larger strings the effect is much smaller)
The key shouldn't be stored as part of the encryption though, should it? I thought the key was supposed to be used to decrypt the data?
I found this link on google and its DES encryption doesn't use any overheads, it turns an 8 byte string into an 8 byte string with the key kept separate and needing to be input when decrypting.
I assume you see my problem now...the length of the inputted string (when zero-padded to the nearest 8 bytes) should be the same as the length of the outputted string, and I am inputting an 8 byte string so it should be outputting an 8 byte string in return but it isn't. I don't know enough about DES or this class to find out why, but it's definitely in the encodebyte section of the class as I checked length at each stage of encodestring and it was when it sent it to encodebyte that the length jumped to 24 :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
Talking of writing my own DES module, I probably will do and will post it here for people to comment on any speed gains I might be able to do to it...I've had a look around and found http://www.tropsoft.com/strongenc/des.htm which gives a simple enough explanation of how DES encryption works :-)
At the worst, I write a working function and people can modify it to improve its speed and it becomes part of the codebank as a collaborative effort :-P
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.