Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > สอบถาม ท่านใดเคยทำ void statement ผ่าน kbank ด้วย php บ้างครับ



 

สอบถาม ท่านใดเคยทำ void statement ผ่าน kbank ด้วย php บ้างครับ

 



Topic : 114418



โพสกระทู้ ( 1 )
บทความ ( 0 )



สถานะออฟไลน์




มี code java encypt ท่านใดพอจะแปลงเป็น php ได้บ้างครับ



Code (Java)
import java.applet.*;

public class SinaptIQ3DES extends Applet {
   public void init() {
	}
	public static final String encrypt(String s)
    {
        String s1 = "";
        try
        {
            SecretKeySpec secretkeyspec = new SecretKeySpec(new byte[] {
                -101, -66, -84, -119, -56, 52, -7, -15, -76, -87, 
                -26, 45, 95, 82, 50, -113, 75, -102, 110, -46, 
                -11, 37, 35, -8
            }, "DESede");
            IvParameterSpec ivparameterspec = new IvParameterSpec(new byte[] {
                -15, -19, 8, 64, -24, 47, -13, -73
            });
            Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding");
            cipher.init(1, secretkeyspec, ivparameterspec);
            Date date = new Date();
            SimpleDateFormat simpledateformat = new SimpleDateFormat("SSSssmmHHddMMyyyy");
            SimpleDateFormat simpledateformat1 = new SimpleDateFormat("yyyyMMddHHmmssSSS");
            String s2 = (new StringBuilder()).append(simpledateformat.format(date)).append(s).append(simpledateformat1.format(date)).toString();
            byte abyte0[] = s2.getBytes();
            byte abyte1[] = cipher.doFinal(abyte0);
            s1 = b64Encode(abyte1);
            cipher = null;
        }
        catch(Exception exception)
        {
            s1 = exception.getMessage();
        }
        return s1;
    }

   public static final String decrypt(String encrypted) {
      String result = "";
      try {
         javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(
                                             new byte[] 
                                                {(byte)0x9b, (byte)0xbe, (byte)0xac, (byte)0x89,
                                                 (byte)0xc8, (byte)0x34, (byte)0xf9, (byte)0xf1,
                                                 (byte)0xb4, (byte)0xa9, (byte)0xe6, (byte)0x2d,
                                                 (byte)0x5f, (byte)0x52, (byte)0x32, (byte)0x8f,
                                                 (byte)0x4b, (byte)0x9a, (byte)0x6e, (byte)0xd2,
                                                 (byte)0xf5, (byte)0x25, (byte)0x23, (byte)0xf8}, "DESede");
         javax.crypto.spec.IvParameterSpec iv = new javax.crypto.spec.IvParameterSpec(
                                 new byte[]
                                    {(byte)0xf1, (byte)0xed, (byte)0x08, (byte)0x40,
                                     (byte)0xe8, (byte)0x2f, (byte)0xf3, (byte)0xb7});
         javax.crypto.Cipher tDes = javax.crypto.Cipher.getInstance("DESede/CBC/PKCS5Padding");
         tDes.init(javax.crypto.Cipher.DECRYPT_MODE, key, iv);
         byte[] encryptedB = b64Decode(encrypted);
         byte[] decrypted = tDes.doFinal(encryptedB);
         result = new String(decrypted);
         result = result.substring(17, result.length()-17);
         tDes = null;
      } catch (Exception e) {
         result = e.getMessage();
      }
      return result;
   }

      private static char[] map1 = new char[64];
      static {
         int i=0;
         for (char c='A'; c<='Z'; c++) map1[i++] = c;
         for (char c='a'; c<='z'; c++) map1[i++] = c;
         for (char c='0'; c<='9'; c++) map1[i++] = c;
         map1[i++] = '+'; map1[i++] = '/';
   }
   
   private static byte[] map2 = new byte[128];
      static {
         for (int i=0; i<map2.length; i++) map2[i] = -1;
         for (int i=0; i<64; i++) map2[map1[i]] = (byte)i;
   }   
   
   private static String b64Encode(byte[] in) {
      int iLen = in.length;
      int oDataLen = (iLen*4+2)/3;
      int oLen = ((iLen+2)/3)*4;
      char[] out = new char[oLen];
      int ip = 0;
      int op = 0;
      while (ip < iLen) {
         int i0 = in[ip++] & 0xff;
         int i1 = ip < iLen ? in[ip++] & 0xff : 0;
         int i2 = ip < iLen ? in[ip++] & 0xff : 0;
         int o0 = i0 >>> 2;
         int o1 = ((i0 &   3) << 4) | (i1 >>> 4);
         int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
         int o3 = i2 & 0x3F;
         out[op++] = map1[o0];
         out[op++] = map1[o1];
         out[op] = op < oDataLen ? map1[o2] : '='; op++;
         out[op] = op < oDataLen ? map1[o3] : '='; op++; }
      return new String(out);
   }

   private static byte[] b64Decode(String str) {
      char[] in = str.toCharArray();
      int iLen = in.length;
      if (iLen%4 != 0) throw new IllegalArgumentException ("Length of Base64 encoded input string is not a multiple of 4.");
      while (iLen > 0 && in[iLen-1] == '=') iLen--;
      int oLen = (iLen*3) / 4;
      byte[] out = new byte[oLen];
      int ip = 0;
      int op = 0;
      while (ip < iLen) {
         int i0 = in[ip++];
         int i1 = in[ip++];
         int i2 = ip < iLen ? in[ip++] : 'A';
         int i3 = ip < iLen ? in[ip++] : 'A';
         if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127)
            throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
         int b0 = map2[i0];
         int b1 = map2[i1];
         int b2 = map2[i2];
         int b3 = map2[i3];
         if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0)
            throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
         int o0 = ( b0       <<2) | (b1>>>4);
         int o1 = ((b1 & 0xf)<<4) | (b2>>>2);
         int o2 = ((b2 &   3)<<6) |  b3;
         out[op++] = (byte)o0;
         if (op<oLen) out[op++] = (byte)o1;
         if (op<oLen) out[op++] = (byte)o2; }
      return out;
   }
}



ขอคำแนะนำด้วยครับ หรือมีวิธีอื่นก็สามารถแนะนำได้ครับ ใช้ php



Tag : PHP, jQuery, CakePHP, JAVA, Linux







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-02-14 11:35:02 By : wonderland View : 690 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook








แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-02-15 07:20:53 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถาม ท่านใดเคยทำ void statement ผ่าน kbank ด้วย php บ้างครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่