# Sha-512 encryption

**URL:** <https://dmap-community.ductus.global/t/sha-512-encryption/3665>\
**Category:** YANG\
**Created:** [May 22, 2021, 7:09am UTC](https://dmap-community.ductus.global/t/sha-512-encryption/3665 "2021-05-22T07:09:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [May 23, 2021, 12:13pm UTC](https://dmap-community.ductus.global/t/sha-512-encryption/3665/2 "2021-05-23T12:13:27Z")

</div>

Most of the time you want to use “length”, “pattern”, and/or “must” statements.

Example:

```auto
type string {
      pattern ".*[0-9]+.*" {
        error-message "The password must have at least one digit";
      }
      pattern ".*[a-z]+.*" {
        error-message "The password must have at least one lower case alpha";
      }
      pattern ".*[A-Z]+.*" {
        error-message "The password must have at least one upper case alpha";
      }
      pattern ".*[<>~;:!@#/$%^&*=-]+.*" {
        error-message "The password must have at least one of these symbols: [<>~;:!@#/$%^&*=-]+";
      }
      pattern ".* .*" {
        modifier invert-match;
        error-message "The password must have no spaces";
      }
      length "8..max" {
        error-message "The password must be at least 8 characters long";
      }
    }

```

If you want to validate the passwords using some code or a script it gets a bit more complicated, as you must add a transform and a validation point.

You can use this demo as a reference on how to do so:

> **[ConfD-Developer/ConfD-Demos](https://github.com/ConfD-Developer/ConfD-Demos/tree/master/passwd-policy-transform)**
>
> Store ConfD Demos here. Contribute to ConfD-Developer/ConfD-Demos development by creating an account on GitHub.

  
The demo uses a C application to serve the transform callpoint and the validation point. You can of course implement the same type of application in for example Python if that is important.

---

_[View the full topic](https://dmap-community.ductus.global/t/sha-512-encryption/3665)._
