Voting

: max(one, seven)?
(Example: nine)

The Note You're Voting On

NOSPAM dot php at my dot jrklein dot com
5 years ago
str_pad() can provide sufficient "zero padding" when using block ciphers and manual padding with openssl_encrypt() and similar.

The example below will pad the 6 character text "Secret" with two \x00 characters and return 8 characters of data. Substitute your plain text and block size as needed.

<?php
$text
= "Secret";
$block_size = 8;
$length = ceil(strlen($text) / $block_size) * $block_size;
$data = str_pad($text, $length, "\x00");

<< Back to user notes page

To Top