input输入框秘钥加密

    input输入框秘钥加密,直接上代码:

    <?php
    
    $key = 'my-secret-key'; // 密钥
    $plaintext = 'sk-1sk-FsgQZt6ChCb************'; // 明文
    
    // 加密
    $ciphertext = openssl_encrypt($plaintext, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, '0123456789abcdef');
    // $ciphertext 现在是加密后的字符串
    
    // 将加密结果插入到 HTML 代码中
    echo '<input class="inputTextClass" type="password" placeholder="sk-xxxxxx" id="keyInput" style="-webkit-text-security: disc;" value="'.base64_encode($ciphertext).'">';
    
    ?>