core :: union_find
union–find algorithm using an efficient disjoint-set data structure
# Mix of utilities and services related to bytes
module bytes
redef class Bytes
# PKCS#7 padding.
#
# Extends `self` by appending the number of bytes of padding to the end of the block.
#
# assert "YELLOW SUBMARINE".to_bytes.pkcs7(20) == "YELLOW SUBMARINE\x04\x04\x04\x04".to_bytes
fun pkcs7(blocksize: Int): Bytes
do
var mod = length % blocksize
if mod == 0 then return self
var pad = blocksize - mod
var byte = pad
for i in [0..pad[ do add byte
return self
end
end
lib/crypto/bytes.nit:15,1--33,3