Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB6 Unicode

VB6 Unicode

Scheduled Pinned Locked Moved Visual Basic
databasesecurityhelpquestion
2 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AccessDeveloper
    wrote on last edited by
    #1

    I'm working on a simple encryption scheeme. I get the asc value of the a character in the string to be encrypted. Adding 255 to it turns it into a uniocode char. Then I use AscW to convert that char into a long. Then I convert the long to a hexidecimal. I store this as the encrypted string in my access database. It looks good sE='the string to be encrypted' for i=1 to len(sE) lValue = Asc(mid(Se,i,1)) + 256 sNew=sNew & format(hex(lvalue),"0000") next i Then I store this string in my access database. The problem lies when I decrypt the encrypted string sE='increpted string' for i=1 to len(se) step 4 lvalue="&h" & mid(se,1,4) sNew=sNew & ChrW(lValue) next i All I get is a lot of ?'s Instead of the unicode string?. Any advice would be appreaciated - Roger

    Richard DeemingR 1 Reply Last reply
    0
    • A AccessDeveloper

      I'm working on a simple encryption scheeme. I get the asc value of the a character in the string to be encrypted. Adding 255 to it turns it into a uniocode char. Then I use AscW to convert that char into a long. Then I convert the long to a hexidecimal. I store this as the encrypted string in my access database. It looks good sE='the string to be encrypted' for i=1 to len(sE) lValue = Asc(mid(Se,i,1)) + 256 sNew=sNew & format(hex(lvalue),"0000") next i Then I store this string in my access database. The problem lies when I decrypt the encrypted string sE='increpted string' for i=1 to len(se) step 4 lvalue="&h" & mid(se,1,4) sNew=sNew & ChrW(lValue) next i All I get is a lot of ?'s Instead of the unicode string?. Any advice would be appreaciated - Roger

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      The immediate problem with your code is that the Hex function will return a three-character string for any character whose ASCII code is less than 3840, but when you try to decode the string, you're taking four characters at a time. The larger problem is that you're trying to invent your own "encryption" algorithm, and that's never a good idea. Use an established and tested algorithm instead. CAPICOM[^] would be a good place to start. Finally, you appear to be starting a new project in a dead language. VB6 was released 15 years ago, and is no longer supported. You should switch to .NET - Visual Studio Express[^] is free, and should be more than enough to get you started.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups