2014-03-06 18:55:56 +00:00
|
|
|
#ifndef ALGORITHM_H
|
|
|
|
#define ALGORITHM_H
|
|
|
|
|
2014-03-06 19:22:33 +00:00
|
|
|
#include <inttypes.h>
|
2014-03-23 06:25:55 +00:00
|
|
|
#include <stdbool.h>
|
2014-03-06 18:55:56 +00:00
|
|
|
|
|
|
|
/* Describes the Scrypt parameters and hashing functions used to mine
|
|
|
|
* a specific coin.
|
|
|
|
*/
|
2014-03-06 20:41:53 +00:00
|
|
|
typedef struct _algorithm_t {
|
2014-03-06 23:29:55 +00:00
|
|
|
char name[20]; /* Human-readable identifier */
|
|
|
|
uint32_t n; /* N (CPU/Memory tradeoff parameter) */
|
|
|
|
uint8_t nfactor; /* Factor of N above (n = 2^nfactor) */
|
2014-03-06 20:41:53 +00:00
|
|
|
} algorithm_t;
|
2014-03-06 18:55:56 +00:00
|
|
|
|
2014-03-06 19:22:33 +00:00
|
|
|
/* Set default parameters based on name. */
|
2014-03-06 19:59:51 +00:00
|
|
|
void set_algorithm(algorithm_t* algo, const char* name);
|
2014-03-06 19:22:33 +00:00
|
|
|
|
|
|
|
/* Set to specific N factor. */
|
2014-03-06 19:59:51 +00:00
|
|
|
void set_algorithm_nfactor(algorithm_t* algo, const uint8_t nfactor);
|
2014-03-06 19:22:33 +00:00
|
|
|
|
2014-03-23 06:25:55 +00:00
|
|
|
/* Compare two algorithm parameters */
|
|
|
|
bool cmp_algorithm(algorithm_t* algo1, algorithm_t* algo2);
|
|
|
|
|
2014-03-06 18:55:56 +00:00
|
|
|
#endif /* ALGORITHM_H */
|