#checksum #fix #validation #generator #protocols

fix_checksum

Crate contains methods to validate/generate FIX-protocol message checksum

1 unstable release

Uses old Rust 2015

0.0.1 Dec 24, 2015

#43 in #fix

Download history 5/week @ 2024-07-29 55/week @ 2024-08-05 95/week @ 2024-08-12 16/week @ 2024-09-09 20/week @ 2024-09-23 15/week @ 2024-09-30 23/week @ 2024-10-07 14/week @ 2024-10-14 8/week @ 2024-10-21 8/week @ 2024-10-28 21/week @ 2024-11-04

52 downloads per month

MIT license

9KB
101 lines

fix_checksum

FIX message checksum validator/generator RUST library


lib.rs:

The fix_checksum crate provides functions that validate FIX message checksum and generate checksum of FIX message.

Examples

use fix_checksum::{validate, generate};
use fix_checksum::FIXChecksumValidatorError::InvalidEmptyMessage;

// Validator
assert_eq!(validate("").unwrap_err(), InvalidEmptyMessage);

let message_parts: Vec<&str> = vec!["8=FIX.4.2", "9=73", "35=0", "49=BRKR",
  "56=INVMGR", "34=235", "52=19980604-07:58:28", "112=19980604-07:58:28", "10=236"];
let mut message: String = message_parts
  .iter()
  .fold(String::new(), |msg, msg_part| msg.to_string() + msg_part + "\x01");
assert_eq!(validate(&message).unwrap(), true);

// Generator
message = message_parts
  .iter()
  .take(8)
  .fold(String::new(), |msg, msg_part| msg.to_string() + msg_part + "\x01");
assert_eq!("236", generate(&message));

No runtime deps