字符串的 Base64 加密和解密

base64加密:

FORM encode_base64  USING    p_business  “字符串string
                    CHANGING p_base64.

  DATA l_xstring TYPE xstring.
  CHECK p_business IS NOT INITIAL.

  CALL METHOD cl_http_utility=>encode_utf8
    EXPORTING
      unencoded = p_business
    RECEIVING
      encoded   = l_xstring.

  CALL METHOD cl_http_utility=>encode_x_base64  
    EXPORTING
      unencoded = l_xstring
    RECEIVING
      encoded   = p_base64.
ENDFORM. 

base64解密:

FORM decoding_base64 CHANGING p_business TYPE string.

  DATA l_xstring TYPE xstring.
  CALL METHOD cl_http_utility=>if_http_utility~decode_x_base64
    EXPORTING
      encoded = p_business
    RECEIVING
      decoded = l_xstring.

  CLEAR p_business.
  CALL METHOD cl_http_utility=>if_http_utility~decode_utf8
    EXPORTING
      encoded   = l_xstring
    RECEIVING
      unencoded = p_business.

ENDFORM. 

 

转载于:https://www.cnblogs.com/caizjian/p/5532185.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值