Chariot Training Classes

Training Courses

I run Chariot's training and mentoring services. We provide training in AngularJS, HTML5, Spring, Hibernate, Maven, Scala, and more.

Chariot Education Services


Chariot Emerging Tech

Learn about upcoming technologies and trends from my colleagues at Chariot Solutions.


Chariot Conferences


« Quizzo in Roo, Securing Resources | Main | Quizzo in Roo, truth be told »

Quizzo in Roo - Security, SHA-256 and OS X

On OS X, there is no sha256sum utility, but a more generic one, shasum. This is good, but it takes standard input or a file, each of which will end up appending a newline on OS X.

Here was the workaround I found (thank you to this Stack Overflow thread).

echo -n passwd|shasum -a256

The -n flag strips the newline. The value I got for 'passwd' was 0d6be69b264717f2dd33652e212b173104b4a647b7c11ae72e9885f11cd312fb. Next, you can put the secure hash in applicationContext-security.xml like this:

    <password-encoder hash="sha-256" />
        <user name="admin"
          authorities="ROLE_ADMIN,ROLE_USER" />
        <user name="user"
          authorities="ROLE_USER" />

On Unix systems, you'll be able to use sha256sum, presumably with the same echo -n input.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>