Find Jobs
Hire Freelancers

Create PHP Decrypt function

$10-30 USD

Completed
Posted over 9 years ago

$10-30 USD

Paid on delivery
Hello, I have this class in JAVA, with 2 methods: criptografar AND descriptografar. I need an equivalent class in PHP code to use in a website. This 2 methods must do the same thing in JAVA (done) and PHP (pendent). thank you ---------------------- import [login to view URL]; import java.security.spec.*; import javax.crypto.*; import javax.crypto.spec.*; public class UtilCriptografia implements Serializable { private static byte[] hexToBytes(String str) { if (str == null) { return null; } else if ([login to view URL]() < 2) { return null; } else { int len = [login to view URL]() / 2; byte[] buffer = new byte[len]; for (int i = 0; i < len; i++) { buffer[i] = (byte) [login to view URL]( [login to view URL](i * 2, i * 2 + 2), 16); } return buffer; } } private static String bytesToHex(byte[] data) { if (data == null) { return null; } else { int len = [login to view URL]; String str = ""; for (int i = 0; i < len; i++) { if ((data[i] & 0xFF) < 16) { str = str + "0" + [login to view URL](data[i] & 0xFF); } else { str = str + [login to view URL](data[i] & 0xFF); } } return [login to view URL](); } } public static String criptografar(String valueLimpo, String theKEY) { byte[] theKey = null; byte[] theMsg = null; byte[] theCph = null; try { theKey = hexToBytes(theKEY); theMsg = hexToBytes(valueLimpo); KeySpec ks = new DESKeySpec(theKey); SecretKeyFactory kf = [login to view URL]("DES"); SecretKey ky = [login to view URL](ks); Cipher cf = [login to view URL]("DES/ECB/NoPadding"); [login to view URL](Cipher.ENCRYPT_MODE, ky); theCph = [login to view URL](theMsg); } catch (Exception e) { [login to view URL](); } return bytesToHex(theCph); } public static String descriptografar(String valueDES, String theKEY) { byte[] theKey = null; byte[] theMsg = null; byte[] theCph = null; try { theKey = hexToBytes(theKEY); theMsg = hexToBytes(valueDES); KeySpec ks = new DESKeySpec(theKey); SecretKeyFactory kf = [login to view URL]("DES"); SecretKey ky = [login to view URL](ks); Cipher cf = [login to view URL]("DES/ECB/NoPadding"); [login to view URL](Cipher.DECRYPT_MODE, ky); theCph = [login to view URL](theMsg); } catch (Exception e) { [login to view URL](); } return bytesToHex(theCph); } }
Project ID: 6872065

About the project

3 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello. I have 2 years experience in commericla Web Development and can start working on it immediantly. Please, let me know if you want to work with me.
$30 USD in 1 day
5.0 (8 reviews)
4.1
4.1
3 freelancers are bidding on average $35 USD for this job
User Avatar
A proposal has not yet been provided
$50 USD in 2 days
4.9 (92 reviews)
5.3
5.3
User Avatar
!! Ready for Trail Job to proof my skills !! I have experience in Web Development around 8+ years with expertise on Java, PHP, MYSQL, SugarCRM, vTiger, WordPress, Opencart, Magento, Drupal, Codeignitor, HTML, CSS, JavaScript, Ajax Development etc. My service are like development of Drupal, Wordpress, Codeignitor web application, creation of new website, make website sites responsive. Each last job have been done with quality and bug free. My mission and objective is give such service to clients so that he want more with you. Why you should hire me? - Availability- 45 hrs/week Flexible with All Time Zones. - Quality Service under your budget. - Quality Online Support. - Reports- Daily Detailed Reports, Weekly and Monthly Reports with needed everything.
$25 USD in 1 day
5.0 (3 reviews)
2.8
2.8

About the client

Flag of BRAZIL
So Paulo, Brazil
5.0
5
Payment method verified
Member since May 4, 2012

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.