Skip to content

Commit

Permalink
add README & change args & rm wrong dependencies.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
asinbow.wang committed Jun 28, 2012
1 parent 10c7b0a commit f6d21c4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
4 changes: 0 additions & 4 deletions README

This file was deleted.

16 changes: 16 additions & 0 deletions README.markdown
@@ -0,0 +1,16 @@
asinbow's test project on heroku
===

### Message Digest

Using java.security.MessageDigest


Provided algorithm:

* SHA-1
* SHA-256
* SHA-384
* SHA-512
* MD2
* MD5
2 changes: 1 addition & 1 deletion app/controllers/Application.scala
Expand Up @@ -22,7 +22,7 @@ object Application extends Controller {
request.body.asJson match {
case Some(json) => {
val md = java.security.MessageDigest.getInstance((json\"algorithm").as[String])
md.update((json\"userinput").as[String].getBytes)
md.update((json\"text").as[String].getBytes)

val mdvalue = org.apache.commons.codec.binary.Hex.encodeHex(md.digest())
Ok(new String(mdvalue))
Expand Down
2 changes: 1 addition & 1 deletion app/views/index.scala.html
Expand Up @@ -19,7 +19,7 @@
type: "POST",
url: "/message_digest",
contentType: "application/json",
data: JSON.stringify({ userinput: userinput, algorithm: algorithm }),
data: JSON.stringify({ text: userinput, algorithm: algorithm }),
success: function(data){
$("#mdvalue").text(data);
},
Expand Down
4 changes: 0 additions & 4 deletions dependencies.yml

This file was deleted.

0 comments on commit f6d21c4

Please sign in to comment.