Skip to content

Commit

Permalink
added checksum jinja filters
Browse files Browse the repository at this point in the history
  • Loading branch information
ribejara-te committed Jan 17, 2025
1 parent 82f8b6d commit 14f81f1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "stacks"
version = "2.0.5"
version = "2.0.6"
description = "Stacks, the Terraform code pre-processor"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
9 changes: 7 additions & 2 deletions src/stacks/filters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
from .throw import throw
from .checksum import md5, sha1, sha256, sha512
from .deepformat import deepformat
from .lookup import variable, output, resource
from .throw import throw


__all__ = [
throw,
md5,
sha1,
sha256,
sha512,
deepformat,
variable,
output,
resource,
throw,
]
17 changes: 17 additions & 0 deletions src/stacks/filters/checksum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import hashlib


def md5(ctx, string):
return hashlib.md5(string.encode()).hexdigest()


def sha1(ctx, string):
return hashlib.sha1(string.encode()).hexdigest()


def sha256(ctx, string):
return hashlib.sha256(string.encode()).hexdigest()


def sha512(ctx, string):
return hashlib.sha512(string.encode()).hexdigest()

0 comments on commit 14f81f1

Please sign in to comment.