ps-datalake 0.1.0-2

Encrypted flat storage
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::error::Result;
use crate::store::MAGIC;
use std::fs::File;
use std::io::Read;

pub fn read_magic(path: &str) -> Result<[u8; 16]> {
    let mut file = File::open(path)?;
    let mut buffer = [0; 16];

    file.read_exact(&mut buffer)?;

    Ok(buffer)
}

pub fn verify_magic(path: &str) -> Result<bool> {
    Ok(read_magic(path)? == MAGIC)
}