Giter Site home page Giter Site logo

How to work with PHP about fclblowfish HOT 3 CLOSED

cantecim avatar cantecim commented on July 18, 2024
How to work with PHP

from fclblowfish.

Comments (3)

gmogames avatar gmogames commented on July 18, 2024

Just tought you should know that I was able to make it work. The encrypted string FclBlowfish was generating was missing some special unicode characters, so the decryption never worked.

Once I opened the .m file and changed from NSISOLatin1StringEncoding in the decrypt method and from NSASCIIStringEncoding in the encrypt method both to NSWindowsCP1252StringEncoding it worked like a charm.

So, maybe using Fcl only inside iOS may work well, but with PHP it needed a tweak.

I posted a question and answer here by the way:
http://stackoverflow.com/questions/28891658/php-and-objective-c-blowfish-encryption-encoding-different/28891960#28891960

Thanks

from fclblowfish.

cantecim avatar cantecim commented on July 18, 2024

You can use random ascii coded string to create iv in php
IV must have ascii chars
Simple work around;

$initializationVectorSize = mcrypt_get_iv_size(MCRYPT_BLOWFISH, 'ecb');
$initializationVector = mcrypt_create_iv($initializationVectorSize, MCRYPT_RAND);
$initializationVector = substr(base64_encode($initializationVector), 0, $initializationVectorSize);

You got the idea. In order to work properly with encoding in ios i done it this way

Thanks for your contributions
Feel free to suggest correct way using encoding in ios to work this lib properly
Any pull request is always welcome

from fclblowfish.

gmogames avatar gmogames commented on July 18, 2024

The problem is I don't have access to the PHP code since it's hosted and ran by a 3rd party company. They were only kind enought to share with me the methods to encrypt/decrypt and I had to make the iOS code match the encryption/decryption.

So, changing the Encoding you were using in the encrypt and decrypt method to the * NSWindowsCP1252StringEncoding* made the encrypted strings have the same characters as the one in PHP. Using Latin or Ascii limits the symbols used by the encryption and they were not matching.

But thank you for the awesome Lib, I wouldn't have patience to do that own my own!

from fclblowfish.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.