<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Apache Commons Crypto

          聯(lián)合創(chuàng)作 · 2023-09-30 07:59

          Apache Commons Crypto 是一個加密庫,使用 AES-NI (Advanced Encryption Standard New Instructions) 進行優(yōu)化。提供了加密級別和流級別的 API。開發(fā)者可以使用最少代碼來實現(xiàn)高性能的 AES 加解密應用。

          Maven:

          <dependency>
              <groupId>org.apache.commons</groupId>
              <artifactId>commons-crypto</artifactId>
              <version>1.0.0</version>
          </dependency>

          示例代碼:

          Properties properties = new Properties();
          //Creates a CryptoCipher instance with the transformation and properties.
          CryptoCipher cipher = Utils.getCipherInstance(CipherTransformation.AES_CTR_NOPADDING, properties);
          
          String input = "hello world!";
          int inputOffset = 0;
          int inputLen = input.length();
          byte[] output = new byte[1024];
          int outputOffset = 0;
          //Initializes the cipher with ENCRYPT_MODE, key and iv.
          cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key,"AES"), new IvParameterSpec(iv));
          //Continues a multiple-part encryption/decryption operation for byte array.
          cipher.update(input.getBytes("UTF-8"), inputOffset, inputLen, output, outputOffset);
          //We should call do final at the end of encryption/decryption.
          cipher.doFinal(inBuffer, outBuffer);
          //Closes the cipher.
          cipher.close();
          瀏覽 18
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  黄色成人观看网站 | 北条麻妃人妻中文字幕91影视 | 欧美性爱操逼网 | 大鸡巴久久久久久 | 激情乱伦中文字幕 |