mirror of
https://github.com/atuinsh/atuin.git
synced 2025-02-17 19:01:22 +01:00
remove sneaky hasher
This commit is contained in:
parent
1cb41cb1ab
commit
687dda19c0
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -159,9 +159,7 @@ name = "atuin-common"
|
|||||||
version = "13.0.1"
|
version = "13.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"hex",
|
|
||||||
"serde",
|
"serde",
|
||||||
"sha2",
|
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -14,5 +14,3 @@ repository = "https://github.com/ellie/atuin"
|
|||||||
chrono = { version = "0.4", features = ["serde"] }
|
chrono = { version = "0.4", features = ["serde"] }
|
||||||
serde = { version = "1.0.145", features = ["derive"] }
|
serde = { version = "1.0.145", features = ["derive"] }
|
||||||
uuid = { version = "1.3", features = ["v7"] }
|
uuid = { version = "1.3", features = ["v7"] }
|
||||||
sha2 = { version = "0.10" }
|
|
||||||
hex = { version = "0.4" }
|
|
||||||
|
@ -7,17 +7,6 @@ pub fn uuid_v7() -> String {
|
|||||||
Uuid::now_v7().as_simple().to_string()
|
Uuid::now_v7().as_simple().to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hash_str(string: &str) -> String {
|
|
||||||
hash_bytes(string.as_bytes())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn hash_bytes(buf: &[u8]) -> String {
|
|
||||||
use sha2::{Digest, Sha256};
|
|
||||||
let mut hasher = Sha256::new();
|
|
||||||
hasher.update(buf);
|
|
||||||
hex::encode(hasher.finalize())
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: more reliable, more tested
|
// TODO: more reliable, more tested
|
||||||
// I don't want to use ProjectDirs, it puts config in awkward places on
|
// I don't want to use ProjectDirs, it puts config in awkward places on
|
||||||
// mac. Data too. Seems to be more intended for GUI apps.
|
// mac. Data too. Seems to be more intended for GUI apps.
|
||||||
|
Loading…
Reference in New Issue
Block a user