NAME

Digest::QuickXor - The QuickXorHash

SYNOPSIS

use Digest::QuickXor;

my $qx = Digest::QuickXor->new;

$qx->add(@data);
$qx->b64digest;

$qx->addfile($filehandle);
$qx->b64digest;

$qx->add($wrong_data);
$qx->reset;
$qx->add($correct_data);

# use as function
use Digest::QuickXor 'quickxorhash';

my $hash = quickxorhash(@data);

DESCRIPTION

Digest::QuickXor implements the QuickXorHash.

The QuickXorHash is the digest used by Microsoft on Office 365 OneDrive for Business and Sharepoint. It was published by Microsoft in 2016 in form of a C# script. The explanation describes it as a "quick, simple non-cryptographic hash algorithm that works by XORing the bytes in a circular-shifting fashion".

FUNCTIONS

None of the functions is exported by default.

quickxorhash

use Digest::QuickXor 'quickxorhash';

my $hash = quickxorhash(@data);

Returns the digest for the provided data.

CONSTRUCTOR

new

$qx = Digest::QuickXor->new;

METHODS

add

$qx = $qx->add($data);
$qx = $qx->add(@data);

Adds new blocks of data.

addfile

$qx = $qx->addfile($filehandle);

Adds data from a file handle.

b64digest

$string = $qx->b64digest;

Returns the digest and resets the object.

reset

$qx = $qx->reset;

Resets the object so it is ready to accept new data.

AUTHOR & COPYRIGHT

© 2019 by Tekki (Rolf Stöckli).

© for the original algorithm 2016 by Microsoft.

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

SEE ALSO

Explanation of the QuickXorHash Algorithm in the OneDrive Dev Center.

QuickXorHash.cs by Ryan Gregg.

quickxor-c, C implementation of the hash, base code for this module.