nitroglycerin v0.1.1 Nitroglycerin.Pad

A struct & constructor for holding the key details about a one-time pad file.

Summary

Functions

Generate a completed Nitroglycerin.Pad from the pathname of a pad file

Record that some of a pad has been used

Functions

from_path(pad_path)

Generate a completed Nitroglycerin.Pad from the pathname of a pad file.

If the pad file doesn’t exist, this struct will form the basis of the one that will be written.

Examples

> Nitroglycerin.Pad.from_path("random.pad")
%Nitroglycerin.Pad{
  path: "random.pad",
  usage_path: "random.pad.usage",
  size: 12345678,
  io: #PID<0.0.0>,
  next_index: 0,
}
used!(pad, bytes_used)

Record that some of a pad has been used.

Assumes that you have used bytes_used bytes from the next_index of the given pad.

Examples

Record that 1024 bytes have been used:

> Nitroglycerin.Pad.used!(pad, 1024)

Ensure a pad has been written to disk:

> Nitroglycerin.Pad.used!(pad, 0)