|
@@ -57,13 +57,13 @@ func encryptPage(path string) {
|
|
password, _ := block.Attr("data-password")
|
|
password, _ := block.Attr("data-password")
|
|
blockhtml, _ := block.Html()
|
|
blockhtml, _ := block.Html()
|
|
data := []byte(blockhtml)
|
|
data := []byte(blockhtml)
|
|
- fmt.Printf("\nSHA1: % x\n", sha1.Sum(data))
|
|
|
|
- sha1_sum := sha1.Sum(data)
|
|
|
|
- sha1_string := hex.EncodeToString(sha1_sum[:])
|
|
|
|
- finalcontent := (blockhtml + "\n<div id='sha1sum'>" + sha1_string + "</div>")
|
|
|
|
- enchtml := encrypt(password, finalcontent)
|
|
|
|
|
|
+ sha1_byte_array := sha1.Sum(data)
|
|
|
|
+ fmt.Printf("SHA1: % x\n\n", sha1_byte_array)
|
|
|
|
+ sha1_string := hex.EncodeToString(sha1_byte_array[:])
|
|
|
|
+ encrypt_this := (blockhtml + "\n<div id='sha1sum'>" + sha1_string + "</div>")
|
|
|
|
+ encrypted_html := encrypt(password, encrypt_this)
|
|
block.RemoveAttr("data-password")
|
|
block.RemoveAttr("data-password")
|
|
- block.SetHtml(enchtml)
|
|
|
|
|
|
+ block.SetHtml(encrypted_html)
|
|
wholehtml, _ := doc.Html()
|
|
wholehtml, _ := doc.Html()
|
|
ioutil.WriteFile(path, []byte(wholehtml), 0644)
|
|
ioutil.WriteFile(path, []byte(wholehtml), 0644)
|
|
}
|
|
}
|