-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patterns: Added Password Safe Version 3 pattern (#266)
* Add password safe V3 * Added description pragma --------- Co-authored-by: Nik <[email protected]>
- Loading branch information
1 parent
4242869
commit bb46276
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Password Safe V3 | ||
// Only a small part of the file is unencrypted. | ||
|
||
#pragma endian little | ||
#pragma description Password Safe V3 | ||
|
||
import std.mem; | ||
import std.sys; | ||
|
||
struct Prologue { | ||
u8 SALT[32]; | ||
u32 ITER; | ||
u8 HPP[32] [[name("H(P')")]]; | ||
u8 B1[16]; | ||
u8 B2[16]; | ||
u8 B3[16]; | ||
u8 B4[16]; | ||
u8 IV[16]; | ||
}; | ||
|
||
struct EOF { | ||
u8 HMAC[32]; | ||
}; | ||
|
||
char magic[4] @ 0x00; | ||
std::assert(magic == "PWS3", "Invalid file: bad tag!"); | ||
char marker[16] @ std::mem::size() - 48; | ||
std::assert(marker == "PWS3-EOFPWS3-EOF", "Invalid file: bad end marker!"); | ||
|
||
Prologue prologue @ 0x04; | ||
u8 HMAC[32] @ std::mem::size() - 32; | ||
|
||
EOF eof @ std::mem::size() - 48; |
Binary file not shown.