Coder Social home page Coder Social logo

nds_getentropy's Introduction

libnds_getentropy: getentropy() for the Nintendo DS and DSi

Currently, the library isn't considered ready for use, but it works.

Usage

Link in the library in your ARM7 code BEFORE all the devkitPro libraries you use.

LIBS := -lnds_getentropy7 -lnds7

In your ARM7 program:

#include <nds_getentropy.h>

int
main(void)
{
	unsigned char entropy[20];

	...
	arm7_getentropy(entropy, sizeof(entropy);

	/* entropy now contains a random sequence of bytes. */
	...
}

Make sure you initialize the hardware properly like the default ARM7 program does.

The interface is almost the same as the BSD getentropy(): https://man.openbsd.org/getentropy.2

The only difference is that getentropy() can be called from anywhere, whereas arm7_getentropy() may only be called from the ARM7.

TODO

While writing a previous version that was never commited to git, I used my example code to debug and saw that the result would only change once a second. It seems some entropy sources don't actually work, I need to write a separate program to print them and see what's wrong.

The example's output is wrong under DeSmuME:

Why does it print all zeroes? A SHA1 hash of a buffer full of zeroes isn't all zeroes, so even if the time of day or the temperature were 0, the returned entropy wouldn't be 0. As it currently stands, the library doesn't work under DeSmuME.

nds_getentropy's People

Contributors

guijan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.