package login;

import java.nio.charset.Charset;
import java.util.Base64;

public class StringCodeTest {

	public static void main(String[] args) {
        System.out.println(ap_base64("13461067662", "abc123"));
        System.out.println(pc_base64("18222288391", "0000"));
	}

	private final static String AUTHORIZATION = "authorization";
	private final static String PREFIX_AP = "Basic ";
	private final static String PREFIX_PC = "Verification ";
    /*
     * 4.153
     * 13576450525	123456	318e235d3e52648b236faa3f748000d5
     * 13724823305	123456	318e235d3e52648b236faa3f748000d5
     * Basic MTM1MTExMTIyMjI6MDAwMDAw
     * Basic MTgwMjIyMjMzMzM6MDAwMDAw
     *
     * 4.155
     * 13511112222	000000	c8937b92506c0e2918de053dea69edd3
     * 18022223333	000000	c8937b92506c0e2918de053dea69edd3
     */
	final static String ap_base64(String account, String password) {
		String authorization = PREFIX_AP + new String(Base64.getEncoder().encodeToString((account+":"+password).getBytes(Charset.forName("UTF-8"))));
		return authorization;
	}
	/*
	 * 4.153
	 * 13576450525	123456	318e235d3e52648b236faa3f748000d5
	 * 13724823305	123456	318e235d3e52648b236faa3f748000d5
	 *
	 * 4.155
	 * 13511112222	000000	c8937b92506c0e2918de053dea69edd3
	 * 18022223333	000000	c8937b92506c0e2918de053dea69edd3
	 */
	final static String pc_base64(String phone, String code) {
		String authorization = PREFIX_PC + new String(Base64.getEncoder().encodeToString((phone+":"+code).getBytes(Charset.forName("UTF-8"))));
		return authorization;
	}

}
