Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am currently learning Java and am starting to use file IO. For a random personal project, I would like a user to create an "account" with a password. I would like to store the information for later, but I would like to have a way to encrypt the password (something even very basic would work for now).
Any tips are much appreciated.
Thanks.
This is where something called Hashing comes in handy. Hash functions work by creating a hash key (integer value) from the original string using a function. The benefit of this is that you can check that a password is correct by checking whether the entered password is the same as the stored hash key, without actually knowing the password.
Creating your own hash function is something you wouldn't normally be expected to do as there are secure hash functions available. Although you may want to play around with them for fun.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
We have found files encoded using XOR Encryption, but Im newbie on JAVA, please how to decrypt XOR using this xor encoder.
The code is generating a random int (4 bytes) and using it to XOR the input - it is not asking for the encryption key, it is generating it randomly. Unless the receiver has some way of knowing what the next random int is, it will not be able to decode. EG, perhaps the sender and receiver are expected to initialize their random generators with the same seed value when they start up. Regardless, it is not a real encryption algorithm, just another example of some half-cocked idea someone invented in their head. You really need to replace this code with a correct usage of encryption.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am developing an Android native game, but I have problems with Data Storage.
For a better comprehension think it like as i am developing Clash of Clans, but with Native Andorid.
Now imagine I have to store all datas for Buildings, moneys, troups, ecc in my local phone DB.
I read some guides about SQLite for Android, but i don't really like it. It picks always a Cursor object and i have to create an "Helper" class for each table so I can convert the Cursor into the object I picked.
I want a library or anything else that allows you to do like windows phone c#:
SQLiteConnection conn = new SQLiteConnection(DBPath);
return conn.Query<TABLE_NAME>(SQL_QUERY);
//in this way i have a list of TABLE_NAME items without any casting or similar.
I learned SugarORM and it is really simple and intuitive, but it has no possibilities for ID usage(or at least really restricted) and a lot of other limitations.
And here is my question: is there a way to do it with SQLite without using cursor or with any other library, but still complete of all (or at least the most useful) functions?
check this link they explain the most five popular database and there characterstics
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm working on my first big project and one thing I need to do is create a log of all the ships in a game and all their stats, their name, class etc... There must be at least over 100 ships. I thought about using a Hashmap, but I would need more than one value per key. I thought about doing a bunch of string arrays, but I think that would take too much memory. Should I read the values in from a .txt file? Any suggestions would be greatly appreciated, and thank you for your time. :D
What is the unique identifier for a ship? You can simply create a hashmap using that unique identifier as the key and the ship instance as the value. In addition, there is nothing preventing you from using a MultiMap to store a collection of values at each key if that makes semantic sense. But this question is rather poorly defined with respect to what you actually want this 'log' to do.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have near about 1 million entries in my database table and
I need to use some logic by which I can search within minimum time,
is there any algorithms or logic by which i can get result within less time.
I tried sorting table alphabetically but till it is taking much more time.
If you have any algorithm or logic then please suggest code in Java.
Looks like you need to ad in index to your database table.
If you tell what database you are using, people can give more specific help.
It dosent matter how much records you have as long as your databse is properly normalised and is having proper index. Having said that, the only difference that will make is how you are using indexes. You cannot do much in java, but your db and its design will play a significant role.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What are some good data structures for keeping track of agents in a two-dimensional, spatial simulation?
I've seen some references to quadtrees (which I understand) and kd-trees (which I don't understand very well).
I'm looking for something through which an agent can efficiently say, "I know my location, and I would like to know which agents are near me (within a certain radius of myself)."
Examples (pseudo-code is fine) would be greatly appreciated.
I'm working in Java.
Well, I'm not sure exactly how it is implemented, but the MASON toolkit uses a discretization algorithm that places agents that are close to one another in the same "bucket" of a hash table. It makes for very fast lookups, as only a few of these buckets have to be checked for each query.
The best thing for you is probably to take a look at the source code here:
http://code.google.com/p/mason/source/browse/trunk/mason/sim/field/continuous/Continuous2D.java?r=529
I have found something called a Bucket PR Quadtree.