woodser / monero-java

Java library for using Monero
https://woodser.github.io/monero-java/javadocs/
MIT License
106 stars 39 forks source link

Improve the validation of Monero addresses. #20

Closed electrotype closed 5 years ago

electrotype commented 5 years ago

This code is based on existing implementations:

More doc:

The PR idea comes from:


Please note that I'm not an expert at this level of coding (dealing with byte[], encryption, etc.). I tried my best to convert the code from implementations in other languages to Java. But maybe I use int[] at some places where byte[] should be used and/or the opposite!

Feel free to improve the code!

Also:

woodser commented 5 years ago

@electrotype

I'm not sure about the rules for the STAGENET network. I don't think I've seen any tests for it anywhere...

The JUnit wallet and daemon tests will test whichever network is configured in TestUtils.java. In this case, these are static utilities which do not use a wallet instance, so testing the static utilities within TestMoneroUtils.java with coverage for the 3 network types seems appropriate.

electrotype commented 5 years ago

@woodser Thanks for your review. As I said, do what you want with this code. I did try to adjust it a bit from my own project to yours but I do not have time for more. I just wanted to share it, since I didn't find any examples in Java.

Feel free to copy/keep any part of this PR you want and delete the PR afterward. I don't care about credits...

I'll try to find time to contribute more in the future. Thanks!

woodser commented 5 years ago

This is still very helpful. I will try to incorporate it while preserving your commit history soon. Thank you again @electrotype!