Net::Fix::Checksum::XS - Fast FIX Checksum calculations from Perl
use Net::Fix::Checksum::XS qw(generate_checksum replace_checksum validate_checksum); # Generate a checksum and return it as a 0-padded string. Any existing # checksum field is ignored. my $checksum = generate_checksum($fixmsg); # Append/replace a checksum to a fix message. Any existing checksum field is # ignored and replaced. my $newmsg = replace_checksum($fixmsg); # Validate checksum of given message. Return true (1) if checksum is present # and valid. validate_checksum($fixmsg) or die "Invalid checksum";
All functions return undef if passed a string that doe not end with a SOH. See "FUNCTIONS" for other possible return values.
undef
SOH
This module calculates, validates and replace checksum on FIX messages. It comes with a simple interface written in C for speed.
None by default. All three methods can be exported.
my $checksum = generate_checksum($fixmsg);
Generate a checksum and return it as a 0-padded string. Any existing checksum field is ignored.
Returns undef if the message does not end with a SOH. No other validity checks are performed.
my $newmsg = replace_checksum($fixmsg);
Append/replace a checksum to a SOH-delimited fix message. Any existing checksum field is ignored and replaced.
Returns undef if the message does not end with a SOH or if the message exceeds the maximum allowed length (see "BUGS" for more info).
my $result = validate_checksum($fixmsg);
Validate checksum of given message. Return 1 if checksum is present and valid, and 0 if the checksum is invalid.
1
0
Returns undef if the message does not end with a SOH or if the checksum field is malformed or invalid.
For speed and simplicity, replace_checksum() is limited to 4095 characters messages by default (including all fields, checksum and trailing separator). This can be changed at compile time; see Makefile.PL.
Functions should take a delimiter optional argument. It should be very easy to implement once we get past XS glue; I just never looked into it.
The code repository is mirrored on https://github.com/dermoth/Net-Fix-Checksum-XS
Thomas Guyot-Sionnest <tguyot@gmail.com>
Copyright (C) 2015 by Thomas Guyot-Sionnest <tguyot@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.2 or, at your option, any later version of Perl 5 you may have available.
To install Net::Fix::Checksum::XS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Fix::Checksum::XS
CPAN shell
perl -MCPAN -e shell install Net::Fix::Checksum::XS
For more information on module installation, please visit the detailed CPAN module installation guide.