mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
16 lines
505 B
HTML
16 lines
505 B
HTML
{{- $content := .Content -}}
|
|
|
|
{{- /* If Hugo Support AES, refactor with AES. */ -}}
|
|
{{- if .Password -}}
|
|
{{- $saltLen := strings.RuneCount (trim .Password " ") -}}
|
|
{{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}}
|
|
{{- $base64EncodeContent := $content | base64Encode -}}
|
|
{{- $content = printf "%v%v%v"
|
|
(substr $base64EncodeContent 0 $saltLen)
|
|
(substr (sha256 .Password) $saltLen)
|
|
(substr $base64EncodeContent $saltLen)
|
|
-}}
|
|
{{- end -}}
|
|
|
|
{{- return $content -}}
|