Results 1 to 11 of 11

Thread: [RESOLVED] Unicode Base64 string encrypt/decrypt

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Resolved [RESOLVED] Unicode Base64 string encrypt/decrypt

    Does anyone have this function? I already got one but it's written for ANSI strings and not for Unicode. I have searched the Internet and found some functions with API but they're buggy, and I've read earlier somewhere that API calls for string encryption act differently on some Windows versions (and I'm asking if that is true?)
    Last edited by MikiSoft; Feb 25th, 2015 at 03:33 PM.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Unicode Base64 string encrypt/decrypt

    In the codebank section, Base64 routines exist. Any decent Base64 routine can process a byte array. To convert your string into a, 2-byte per character array, simply: myByteArray() = myUnicodeString
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Unicode Base64 string encrypt/decrypt

    I have only found your function there for Base85 encoding but I can't get it to work properly with Unicode strings. Can you give me concrete example?

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Unicode Base64 string encrypt/decrypt

    Base85 is probably not what you want. If you want to play with it more, then the zDecodeArray & zEncodeArray methods take, as the final parameter, the increment value which is passed as 2 in the sample code. Pass it as 1 to process every byte vs every other byte.

    I thought CVMichael had a Base64 routine in the codebank. The one I use was modified from his. I might be able to post that later when I get home, I don't have it where I'm at now. However, you said you have a Base64 that works for ANSI. Does it process a byte array? If so, does it process every other byte (i.e., for x = y to z Step 2)? If so, remove the Step 2 portion of the loop so every byte is processed.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: Unicode Base64 string encrypt/decrypt

    dilettante has a very nice, minimalist example here:

    http://www.vbforums.com/showthread.p...=1#post3186994

    I am not aware of any issues with the two relevant crypto API functions (CryptStringToBinary and CryptBinaryToString), and they are likely to be much faster than a VB-specific solution.
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Unicode Base64 string encrypt/decrypt

    Thanks, Tanner_H! I think that my problem is now solved

    @LaVolpe: Maybe I searched wrong because I've only used keyword "base64" but not "base 64". Thanks to you too for trying to help me, I appreciate that.
    Last edited by MikiSoft; Feb 25th, 2015 at 05:10 PM.

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Unicode Base64 string encrypt/decrypt

    Quote Originally Posted by Tanner_H View Post
    dilettante has a very nice, minimalist example...
    Tanner, you forgot to precede that statement with, "Since XP is 6 feet under, ...." I know dilettante would've approved
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] Unicode Base64 string encrypt/decrypt

    Those API calls are much fuller-featured on supported versions of Windows.

  9. #9
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: Unicode Base64 string encrypt/decrypt

    Quote Originally Posted by LaVolpe View Post
    Tanner, you forgot to precede that statement with, "Since XP is 6 feet under, ...." I know dilettante would've approved
    Yikes, you're absolutely right! Let me try this again:

    dilettante has a very nice, minimalist example to share, but it's not meant for delusional .NUT-cases or the unwashed plebeians who use disease-ridden filth like XP.
    My apologies to all for not prefacing my original post correctly.
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] Unicode Base64 string encrypt/decrypt

    Wow I just got 100 new spam emails relayed through zombied XP machines.

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] Unicode Base64 string encrypt/decrypt

    The XP Zombie Apocalypse, Are You Ready?

    Too late, that warning came a year ago.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width