joppiesaus
Member since Apr 2015 • Last active Jul 2015Most recent activity
-
Yes
You don't even need to power it via the USB, you could also power it by connecting it to BAT_IN and the GND pin(the two front pins), as long as the input voltage is ≥ 3.5 & ≤ 16v!On-board 3.3v 250mA voltage regulator, accepts voltages from 3.5v to 16v
-
You are right. But this is actually not a problem if the data is 100% random, because the chance that the message is "Attack from the north" is the same as "Attack from the south", or "I like cats so much!!"
But your key can be very large! You could pick different or random indexes from the key. Maybe that's a solution.
Or come up with something else. -
Is XOR Encryption with the One-Time pad an option for you?
If the key you use is random, this encryption will be uncrack-able.
And the encrypted message isn't longer then the not-encrypted message.Here's some pseudo-code:
var key = <random data> var message; function encryptMessage() { message ^= key; } function decryptMessage() { message ^= key; }
-
I'm having the same problem here: The current random generator is based on the state of the machine and time. If you disconnect the power and reconnect it again, the number sequence will be the same, which is for some usages not suitable.
I've thought about fixes for it: Adding a number of how many times it has booted or analog reading something unused(getting random noise).
I'm not a RNG expert thought, but randomness should always be unpredictable. -
- 7 comments
- 2,810 views
-
-
So I'm still enjoying to work on my fruitmachine, but the way I implement multiple timeouts don't seem to work correctly.
Basically, I've 3 LED's, or fruits - or wheels, and I stop them one by one in order of time. When I spin the wheel, I tell it when to stop spinning. It works by just setting the velocity of the wheel to 0.Wheel.prototype.spin = function(stopt) // stopt = stoptime { this.vel = (2 + Math.random() * 5) / 40; // give the wheel a velocity setTimeout(this.stop, stopt); // tell it when to stop };
Then you have the
stop
functionWheel.prototype.stop = function() { this.vel = 0.0; };
The spinning happens when the user clicks the button. At that time,
spin
is called(notWheel.spin
)function spin() { for (var i = 0; i < N_LEDS;) // loop trough all wheels, spin them { wheels[i].spin((++i * 500)); } setTimeout(function(){ //... other code. It checks some win conditions and lights and stuff after every wheel stopped. }, (N_LEDS + 2.5) * 500);
But, only the last
setTimeout
seems to be called.
What am I doing wrong?Here's the full code.
-
- 6 comments
- 3,060 views
-
-
I like to do stuff
http://joppiesaus.function1.nl/