Retracting my offer, as GPUs are now useless for sha256 mining.
Yes, the OP was long ago updated to reflect current bounty status (15 BTC from me).
It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
/**
* Some utility functions to process integers represented as float2.
*/
/**
* Add 2 integers represented as float2.
*
* Do not let overflow happen with this function, or use sum_c instead!
*/
kernel float2 add( float2 a, float2 b) {
float2 ret;
ret.x = a.x + b.x;
ret.y = a.y + b.y;
if (ret.y >= 65536.0) {
ret.y -= 65536.0;
ret.x += 1.0;
}
if (ret.x >= 65536.0) {
ret.x -= 65536.0;
}
return ret;
}
/**
* Shift an integer represented as a float2 by log2(shift).
*
* Note: shift should be a power of two, e.g. to shift 3 steps, use 2^3.
*/
kernel float2 shiftr( float2 a, float shift) {
float2 ret;
ret.x = a.x / shift;
ret.y = floor( a.y / shift) + frac( ret.x) * 65536.0;
ret.x = floor( ret.x);
return ret;
}
/**
* Rotate an integer represented as a float2 by log2(shift).
*
* Note: shift should be a power of two, e.g. to rotate 3 steps, use 2^3.
*/
kernel float2 rotater( float2 a, float shift) {
float2 ret;
ret.x = a.x / shift; // Shipt words and keep fractions to shift those bits later.
ret.y = a.y / shift;
ret.y += frac( ret.x) * 65536.0; // Shift low bits from x into y;
ret.x += frac( ret.y) * 65536.0; // Rotate low bits from y into x;
ret.x = floor( ret.x); // Cut shifted bits.
ret.y = floor( ret.y);
return ret;
}
/**
* Xor half of an integer, represented as a float.
*/
kernel float xor16( float a<>, float b<>) {
float ret = 0;
float fact = 32768.0;
while (fact > 0) {
if( ( ( a >= fact) || ( b >= fact)) && ( ( a < fact) || ( b < fact))) {
ret += fact;
}
if( a >= fact) {
a -= fact;
}
if (b >= fact) {
b -= fact;
}
fact /= 2.0;
}
return ret;
}
/**
* Xor a complete integer represetended as a float2.
*/
kernel float2 xor( float2 a<>, float2 b<>) {
float2 ret = { xor16( a.x, b.x), xor16( a.y, b.y) };
return ret;
}
/**
* And operation on half of an integer, represented as a float.
*/
kernel float and16( float a<>, float b<>) {
float ret = 0;
float fact = 32768.0;
while (fact > 0) {
if( ( a >= fact) && ( b >= fact)) {
ret += fact;
}
if( a >= fact) {
a -= fact;
}
if (b >= fact) {
b -= fact;
}
fact /= 2.0;
}
return ret;
}
/**
* And operation on a full integer, represented as a float2.
*/
kernel float2 and( float2 a<>, float2 b<>) {
float2 ret = { and16( a.x, b.x), and16( a.y, b.y) };
return ret;
}
/*
* Logical complement ("not")
*/
kernel float2 not( float2 a<>) {
float2 ret = { 65535.0 - a.x, 65535.0 - a.y};
return ret;
}
/**
* Swap the 2 words of an int.
*/
kernel swapw( float2 a) {
float2 ret;
ret.x = a.y;
ret.y = a.x;
return ret;
}
kernel float2 blend( float2 m16, float2 m15, float2 m07, float2 m02) {
float2 s0 = xor( rotater( m15, 128.0), xor( rotater( swapw( m15), 4.0), shiftr( m15, 8)));
float2 s1 = xor( rotater( swapw( m02), 2.0), xor( rotater( swapw( m02), 8.0), shiftr( m02, 1024.0)));
return add( add( m16, s0), add( m07, s1));
}
kernel float2 e0( float2 a) {
return xor( rotater( a, 4.0), xor( rotater( a, 8192.0), rotater( swapw( a), 64.0)));
}
kernel float2 e1( float2 a) {
return xor( rotater( a, 64.0), xor( rotater( a, 2048.0), rotater( swapw( a), 512.0)));
}
kernel float2 ch( float2 a, float2 b, float2 c) {
return xor( and( a, b), and( not( a), c));
}
kernel float2 maj( float2 a, float2 b, float2 c) {
return xor( xor( and( a, b), and( a, c)), and( b, c));
}
#include//C standard IO
#include//C standard lib
#include//C string lib
#include//GLEW lib
#include//GLUT lib
//Function from: http://www.evl.uic.edu/aej/594/code/ogl.cpp
//Read in a textfile (GLSL program)
// we need to pass it as a string to the GLSL driver
char *textFileRead(char *fn) {
FILE *fp;
char *content = NULL;
int count=0;
if (fn != NULL) {
fp = fopen(fn,"rt");
if (fp != NULL) {
fseek(fp, 0, SEEK_END);
count = ftell(fp);
rewind(fp);
if (count > 0) {
content = (char *)malloc(sizeof(char) * (count+1));
count = fread(content,sizeof(char),count,fp);
content[count] = '\0';
}
fclose(fp);
}
}
return content;
}
//Function from: http://www.evl.uic.edu/aej/594/code/ogl.cpp
//Read in a textfile (GLSL program)
// we can use this to write to a text file
int textFileWrite(char *fn, char *s) {
FILE *fp;
int status = 0;
if (fn != NULL) {
fp = fopen(fn,"w");
if (fp != NULL) {
if (fwrite(s,sizeof(char),strlen(s),fp) == strlen(s))
status = 1;
fclose(fp);
}
}
return(status);
}
/**
* Setup shaders
*/
void setShaders() {
char *my_fragment_shader_source;
// char * my_vertex_shader_source;
GLenum error;
GLenum my_program;
// GLenum my_vertex_shader;
GLenum my_fragment_shader;
// Get Vertex And Fragment Shader Sources
my_fragment_shader_source = textFileRead( "sha256.glsl");
// my_vertex_shader_source = GetVertexShaderSource();
// my_vertex_shader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
my_fragment_shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
// Load Shader Sources
// glShaderSourceARB(my_vertex_shader, 1, &my_vertex_shader_source, NULL);
glShaderSourceARB( my_fragment_shader, 1, (const GLcharARB** )&my_fragment_shader_source, NULL);
// Compile The Shaders
// glCompileShaderARB(my_vertex_shader);
glCompileShaderARB(my_fragment_shader);
// Check for compile errors
int compiled = 0;
glGetObjectParameterivARB( my_fragment_shader, GL_OBJECT_COMPILE_STATUS_ARB, &compiled );
if ( !compiled ) {
int maxLength;
glGetShaderiv( my_fragment_shader, GL_INFO_LOG_LENGTH, &maxLength);
/* The maxLength includes the NULL character */
char *fragmentInfoLog = malloc( maxLength *sizeof(char));
glGetShaderInfoLog( my_fragment_shader, maxLength, &maxLength, fragmentInfoLog);
printf( "Compile error log: %s\n\n", fragmentInfoLog);
/* Handle the error in an appropriate way such as displaying a message or writing to a log file. */
/* In this simple program, we'll just leave */
free( fragmentInfoLog);
// printf( "compile error...\n" );
}
// Create Shader And Program Objects
my_program = glCreateProgramObjectARB();
if(( error=glGetError()) != GL_NO_ERROR) {
exit( error);
}
// Attach The Shader Objects To The Program Object
// glAttachObjectARB(my_program, my_vertex_shader);
glAttachObjectARB(my_program, my_fragment_shader);
// Link The Program Object
glLinkProgramARB(my_program);
// Use The Program Object Instead Of Fixed Function OpenGL
glUseProgramObjectARB(my_program);
}
int main( int argc, char *argv[]) {
glutInit(&argc, argv);
//glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("GPU");
// glutDisplayFunc(renderScene);
// glutIdleFunc(renderScene);
// glutReshapeFunc(changeSize);
// glutKeyboardFunc(processNormalKeys);
glewInit();
if (glewIsSupported("GL_VERSION_2_1"))
printf("Ready for OpenGL 2.1\n");
else {
printf("OpenGL 2.1 not supported\n");
exit(1);
}
if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GL_EXT_geometry_shader4)
printf("Ready for GLSL - vertex, fragment, and geometry units\n");
else {
printf("Not totally ready :( \n");
exit(1);
}
setShaders();
glutMainLoop();
// just for compatibiliy purposes
return 0;
// glDeleteObjectARB( my_program);
// glDeleteObjectARB( my_fragment_shader);
}
PROGRAM := glslminer
SOURCES := $(wildcard *.c)
CC = gcc
CCOPTS =
LINKEROPTS = -lGL -lGLEW -lglut
.PHONY: all
all:
$(CC) $(CCOPTS) $(LINKEROPTS) $(SOURCES) -o $(PROGRAM)
.PHONY: clean
rm *.o
localhost glsl # ./glslminer
Ready for OpenGL 2.1
Ready for GLSL - vertex, fragment, and geometry units
Compile error log: 0(232) : error C1031: swizzle mask element not present in operand "zw"
0(233) : error C1031: swizzle mask element not present in operand "zw"