[pve-devel] [PATCH v3 qemu-server 08/11] blockdev: convert drive_mirror to blockdev_mirror
DERUMIER, Alexandre
alexandre.derumier at groupe-cyllene.com
Thu Jan 16 15:56:46 CET 2025
>>Yes, we don't need much to get enough collision-resistance. Just
>>wanted
>>to make sure and check it explicitly.
I have done some test with sha1, with base62 encode ('0..9', 'A..Z',
'a..z)
the node-name require to start with an alpha character prefix
encodebase62(sha1("$volid-$snapid") : 5zU4nVxN7gIUWMaskKc4y6EawWu
28characters
so we have space to prefix like for example:
f-5zU4nVxN7gIUWMaskKc4y6EawWu for fmt-node
e-5zU4nVxN7gIUWMaskKc4y6EawWu for file-node
sub encode_base62 {
my ($input) = @_;
my @chars = ('0'..'9', 'A'..'Z', 'a'..'z');
my $base = 62;
my $value = 0;
foreach my $byte (unpack('C*', $input)) {
$value = $value * 256 + $byte;
}
my $result = '';
while ($value > 0) {
$result = $chars[$value % $base] . $result;
$value = int($value / $base);
}
return $result || '0';
}
More information about the pve-devel
mailing list