Jump to content

Search the Community

Showing results for tags 'vba'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi everyone first time poster here wOOt! Question is about encryption in Visual Basic then dercrypted on PHP Here are my encryption decryption functions they work fine. The problem is when I pass the base64_encode(encryptedstring) to my web app via parameter string the decryption works mostly well on several smaller strings but longer strings only decrypt halfway! PHP Decrypt: function php_DecryptValue($cypher,$key){ // Our output text $outText = ''; // Iterate through each character for($i=0;$i<strlen($cypher) // Dont need to increment here { for($j=0;$j<strlen($key);$j++,$i++) { $outText .= $key{$j} ^ $cypher{$i}; } } return $outText; } VB6/VBA Encrypt Public Function php_EncryptValue(strText As String, strKey As String) As String 'strText length should match strkey length for maximum strength Dim i As Integer 'Loop counter Dim intKeyChar As Integer 'Character within the key that we'll use to encrypt Dim strTemp As String 'Store the encrypted string as it grows Dim strChar1 As String * 1 'The first character to XOR Dim strChar2 As String * 1 'The second character to XOR Dim s 'Loop through each character in the text For i = 1 To Len(strText) 'Get the next character from the text strChar1 = Mid(strText, i, 1) 'Find the current "frame" within the key intKeyChar = ((i - 1) Mod Len(strKey)) + 1 'Get the next character from the key strChar2 = Mid(strKey, intKeyChar, 1) 'Convert the charaters to ASCII, XOR them, and convert to a character again strTemp = strTemp & Chr(Asc(strChar1) Xor Asc(strChar2)) Next i 'Display the resultant encrypted string php_EncryptValue = strTemp End Function So theses algorithms match up fine I encrypt a string in VBA then base64encode it, then urlencode it and pass it to my webapp like this: http://www.MyWebApp.com/index.php?Hash=sdjafkjlsflsaklfjlasjdlfblahblahblah if the string is 300 or so characters it works, when the string is 700-2000 I have issues but I really feel like its a php encoding issue and not with the encryption algorithms. If I encrypt a string and base encode it my vba app and then paste that value into the decrypt php function i get the string I want. But when I pass it via URL it goes straight to pot. I have tried urlencode on the passed string, I've tried rawurlencode / rawurldecode on the string I've tried just base64_encode/base64_decode but nothing is working 100% Would some php guru kindly point out my mistake? PHP is not my primary language, and I really feel like this is an encoding issue that I'm not seeing clearly. Thanks! David
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.