Skip to content

Commit 0483636

Browse files
committed
src:migrate:intermediate:working
1 parent 6f0486c commit 0483636

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use pulldown_cmark::Options;
66
use pulldown_cmark::{html, Parser as HTMLParser};
77
use rust_embed::Embed;
88

9+
use sha2::Sha256;
10+
use sha2::Digest;
911
use std::io;
1012
use std::io::{stdout, Write};
1113
use std::path::{Path, PathBuf};
@@ -92,6 +94,12 @@ pub struct Args {
9294
pub export_path: Option<PathBuf>,
9395
}
9496

97+
pub fn calculate_sha256(data: &[u8]) -> String {
98+
let mut hasher = Sha256::new();
99+
hasher.update(data);
100+
format!("{:x}", hasher.finalize())
101+
}
102+
95103
pub async fn extract(filename: &str, output_dir: &Path) -> io::Result<()> {
96104
match Template::get(filename) {
97105
Some(embedded_file) => {

src/main.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ use tracing_subscriber::{fmt, layer::SubscriberExt, EnvFilter, Registry};
7676
// }
7777
//}
7878

79-
fn calculate_sha256(data: &[u8]) -> String {
80-
let mut hasher = Sha256::new();
81-
hasher.update(data);
82-
format!("{:x}", hasher.finalize())
83-
}
84-
8579
#[tokio::main]
8680
async fn main() -> Result<(), Box<dyn std::error::Error>> {
8781
let args = Args::parse();

0 commit comments

Comments
 (0)