# AES - Login algorithm

**URL:** https://discourse.processing.org/t/aes-login-algorithm/8951
**Category:** Coding Questions
**Created:** [March 5, 2019, 12:53am UTC](https://discourse.processing.org/t/aes-login-algorithm/8951 "2019-03-05T00:53:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [March 5, 2019, 12:53am UTC](https://discourse.processing.org/t/aes-login-algorithm/8951/1 "2019-03-05T00:53:38Z")

</div>

Hi.

I want to create a login system, not a different one.  
How would you not have a sample code created through a security algorithm?

Please help me.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [March 7, 2019, 9:07pm UTC](https://discourse.processing.org/t/aes-login-algorithm/8951/2 "2019-03-07T21:07:03Z")

</div>

A login system – what kind, for what kind of sketch?

1. p5.js?
2. Processing(Java), with passwords stored in the sketch?
3. Processing(Java), with passwords stored on the local computer?
4. Processing(Java), with passwords stored on a remote server?

You may be interested in:

- [https://howtodoinjava.com/security/aes-256-encryption-decryption/](https://howtodoinjava.com/security/aes-256-encryption-decryption/)
- [https://howtodoinjava.com/security/java-aes-encryption-example/](https://howtodoinjava.com/security/java-aes-encryption-example/)
- [https://stackoverflow.com/questions/15554296/simple-java-aes-encrypt-decrypt-example](https://stackoverflow.com/questions/15554296/simple-java-aes-encrypt-decrypt-example)

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [March 7, 2019, 11:44pm UTC](https://discourse.processing.org/t/aes-login-algorithm/8951/3 "2019-03-07T23:44:20Z")

</div>

@jeremydouglass

Thank you for your interest.

Processing (Java), with passwords stored on the local computer.  
I want to import it from a .csv or .json file and process it. I do not know how to do algorithm encryption.

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [March 8, 2019, 1:01am UTC](https://discourse.processing.org/t/aes-login-algorithm/8951/4 "2019-03-08T01:01:54Z")

</div>

only have a MD5 password in a file  
and use javax swing windows for the operator input  
the password version is tricky…

[http://kll.engineering-news.org/kllfusion01/articles.php?article\_id=154#here16](http://kll.engineering-news.org/kllfusion01/articles.php?article_id=154#here16)

incl a 2D and a 3D show framework

the focus on this exercise was to create a code what even run  
if the data path / settings file does not yet exist! so it is created…  
so a code copy without ZIP would be possible.  
but as it uses 4 TABs ( .pde ) that part is secondary.

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [March 14, 2019, 12:12am UTC](https://discourse.processing.org/t/aes-login-algorithm/8951/5 "2019-03-14T00:12:02Z")

</div>

@kll  
HELLO, Thank you very much for your reply.

I saw your source program well.  
What is this algorithm?

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [March 14, 2019, 2:35am UTC](https://discourse.processing.org/t/aes-login-algorithm/8951/6 "2019-03-14T02:35:12Z")

</div>

[https://docs.oracle.com/javase/7/docs/api/java/security/MessageDigest.html](https://docs.oracle.com/javase/7/docs/api/java/security/MessageDigest.html)

i used the MD5…

```auto
// _____________________________________________________
String get_hash(String originalpw) {
  try {
    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(originalpw.getBytes());
    byte[] digest = md.digest();
    StringBuilder sb = new StringBuilder(32);
    for (byte b : digest) sb.append(String.format("%02x", b & 0xff));
    return sb.toString();
  } 
  catch (java.security.NoSuchAlgorithmException e) {
    return null;
  }
}

```

not remember where i found that.  
possibly read [https://www.baeldung.com/java-md5](https://www.baeldung.com/java-md5)  
anyhow, my settings file is a readable text file in the data/ subdir.  
so a password in plain text would not do much good.

many web ( like CMS ) login use MD5, as it is not that secure some do a MD5(MD5)

but in my test it is just to differentiate between a app user and a app admin ( what can save layout changes ) ( and not multi user… )

anyhow the challenge is not the password ( encrypted storage )  
it is the password input field ( and that has in my version bugs )

so why you not check out the G4P password thing  
[http://www.lagers.org.uk/g4p/ref/classg4p\_\_controls\_1\_1\_g\_password.html](http://www.lagers.org.uk/g4p/ref/classg4p__controls_1_1_g_password.html)  
like in example G4P/G4P\_EditTextControls
