diff --git a/MacMiner/AppDelegate.m b/MacMiner/AppDelegate.m index 9790f08..0149393 100644 --- a/MacMiner/AppDelegate.m +++ b/MacMiner/AppDelegate.m @@ -35,7 +35,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification NSString *hideVersion = [prefs objectForKey:@"hideVersion"]; - if ([hideVersion isEqualToString:@"158"]) { + if ([hideVersion isEqualToString:@"1510"]) { [self.releaseNotes orderOut:nil]; } @@ -264,6 +264,8 @@ -(void)mobileCommandsThread { NSString *appID = [prefs objectForKey:@"appID"]; NSString *machineName = [[NSHost currentHost] localizedName]; + machineName = [machineName stringByReplacingOccurrencesOfString:@" " withString:@"_"]; + machineName = [machineName stringByReplacingOccurrencesOfString:@"-" withString:@"_"]; if (machineName.length <= 1) { machineName = @"Mac"; } @@ -353,6 +355,8 @@ - (void)mobilePost NSString *appID = [prefs objectForKey:@"appID"]; NSString *machineName = [[NSHost currentHost] localizedName]; + machineName = [machineName stringByReplacingOccurrencesOfString:@" " withString:@"_"]; + machineName = [machineName stringByReplacingOccurrencesOfString:@"-" withString:@"_"]; if (machineName.length <= 1) { machineName = @"Mac"; } @@ -439,6 +443,8 @@ - (void)mobilePostThread { NSString *appID = [prefs objectForKey:@"appID"]; NSString *machineName = [[NSHost currentHost] localizedName]; + machineName = [machineName stringByReplacingOccurrencesOfString:@" " withString:@"_"]; + machineName = [machineName stringByReplacingOccurrencesOfString:@"-" withString:@"_"]; if (machineName.length <= 1) { machineName = @"Mac"; } @@ -538,7 +544,7 @@ - (IBAction)hideVersionStuff:(id)sender { NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; - [prefs setObject:@"158" forKey:@"hideVersion"]; + [prefs setObject:@"1510" forKey:@"hideVersion"]; [prefs synchronize]; diff --git a/MacMiner/MacMiner-Info.plist b/MacMiner/MacMiner-Info.plist index 6e1e921..2a91114 100644 --- a/MacMiner/MacMiner-Info.plist +++ b/MacMiner/MacMiner-Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.5.8 + 1.5.10 CFBundleSignature ???? CFBundleVersion - 1508 + 1510 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MacMiner/asicMiner.h b/MacMiner/asicMiner.h index a5d5cd5..313f4c1 100644 --- a/MacMiner/asicMiner.h +++ b/MacMiner/asicMiner.h @@ -25,6 +25,8 @@ NSTimer *toggleTimer; NSTimer *loopTimer; + + NSTimer *timerTimer; diff --git a/MacMiner/asicMiner.m b/MacMiner/asicMiner.m index 13ea3fe..a676d43 100644 --- a/MacMiner/asicMiner.m +++ b/MacMiner/asicMiner.m @@ -27,9 +27,9 @@ - (id)initWithCoder:(NSCoder *)aDecoder self.apiDataArray = [[NSMutableArray alloc] init]; - loopTimer = [NSTimer scheduledTimerWithTimeInterval:5. target:self selector:@selector(toggleLoopTimerFired:) userInfo:nil repeats:YES]; + [self startToggling]; - toggleTimer = [NSTimer scheduledTimerWithTimeInterval:5. target:self selector:@selector(startToggling) userInfo:nil repeats:NO]; + toggleTimer = [NSTimer scheduledTimerWithTimeInterval:250. target:self selector:@selector(startToggling) userInfo:nil repeats:YES]; self.prefs = [NSUserDefaults standardUserDefaults]; @@ -38,6 +38,114 @@ - (id)initWithCoder:(NSCoder *)aDecoder self.minerAddressesArray = [[NSMutableArray alloc] init]; // self.minerAddressesArray = [self.prefs objectForKey:@"ipAddress"]; + if ([[self.prefs objectForKey:@"startAsic"] isEqualToString:@"start"]) { + + + [self.asicStartButton setTitle:@"Stop"]; + self.asicStartButton.tag = 0; + self.asicAPIOutput.string = @""; + + + // If the task is still sitting around from the last run, release it + if (asicTask!=nil) { + asicTask = nil; + } + + + + + + + + self.noGPU = [self.prefs stringForKey:@"disableASICGPU"]; + self.debugOutputOn = [self.prefs stringForKey:@"debugASICOutput"]; + self.quietOutputOn = [self.prefs stringForKey:@"quietASICOutput"]; + self.bonusOptions = [self.prefs stringForKey:@"asicOptionsValue"]; + NSString *cpuThreads = [self.prefs stringForKey:@"cpuASICThreads"]; + + + + NSMutableArray *launchArray = [NSMutableArray arrayWithObjects: @"-T", @"--api-listen", @"--api-allow", @"W:0/0", nil]; + if ([self.bonusOptions isNotEqualTo:@""]) { + NSArray *deviceItems = [self.bonusOptions componentsSeparatedByString:@" "]; + + [launchArray addObjectsFromArray:deviceItems]; + } + + if ([cpuThreads isNotEqualTo:nil]) { + [launchArray addObject:@"-t"]; + [launchArray addObject:cpuThreads]; + } + else { + [launchArray addObject:@"-t"]; + [launchArray addObject:@"0"]; + } + + if ([self.debugOutputOn isNotEqualTo:nil]) { + [launchArray addObject:self.debugOutputOn]; + } + if ([self.quietOutputOn isNotEqualTo:nil]) { + [launchArray addObject:self.quietOutputOn]; + } + + if (self.bigpicEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"bigpic:all"]; + } + if (self.antminerEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"antminer:all"]; + } + if (self.bflEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"bfl:all"]; + } + if (self.bitfuryEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"bifury:all"]; + } + if (self.erupterEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"erupter:all"]; + } + + + + if ([self.noGPU isNotEqualTo:nil]) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"opencl:auto"]; + } + + cpuThreads = nil; + + NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"]; + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSString *userpath = [paths objectAtIndex:0]; + userpath = [userpath stringByAppendingPathComponent:executableName]; // The file will go in this directory + NSString *saveBTCConfigFilePath = [userpath stringByAppendingPathComponent:@"bfgurls.conf"]; + + [launchArray addObject:@"-c"]; + [launchArray addObject:saveBTCConfigFilePath]; + + + + NSString *bundlePath2 = [[NSBundle mainBundle] resourcePath]; + + NSString *bfgPath = [bundlePath2 stringByAppendingString:@"/bfgminer/bin/bfgminer"]; + + [self.asicOutputView setString:@""]; + + asicTask =[[TaskWrapper alloc] initWithCommandPath:bfgPath + arguments:launchArray + environment:nil + delegate:self]; + // kick off the process asynchronously + + [asicTask startTask]; + + + } + } @@ -98,7 +206,8 @@ - (IBAction)start:(id)sender asicTask=nil; - +self.megaHashLabel.stringValue = @"0"; + self.megaHashLabel.tag = 0; AppDelegate *appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate]; @@ -229,29 +338,167 @@ - (void)toggleLoopTimerFired:(NSTimer*)timer AppDelegate *appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate]; - if([apiOutputString hasPrefix:@"R"] && [apiOutputString hasSuffix:@")"]) { - +// Just messing around here +// NSData *data = [self.asicAPIOutput.string dataUsingEncoding:NSUTF8StringEncoding]; +// NSError *error; +// if ([NSJSONSerialization JSONObjectWithData:data +// options:kNilOptions +// error:&error] != nil) { +// NSLog(@"here"); +// id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; +// NSLog(@"%@",[json objectForKey:@"STATUS"]); +// } +// - [self.prefs synchronize]; + + + + if([apiOutputString hasPrefix:@"R"] && [apiOutputString hasSuffix:@")"]) { + + + [self.prefs synchronize]; appDelegate.mobileMinerDataArray = nil; appDelegate.mobileMinerDataArray = [[NSMutableArray alloc]init]; if ([appDelegate.mobileMinerStatus isEqualToString:@"START"]) { - [self start:nil]; +// [self start:nil]; appDelegate.mobileMinerStatus = @"NONE"; + [self.asicStartButton setTitle:@"Stop"]; + self.asicStartButton.tag = 0; + self.asicAPIOutput.string = @""; + + + // If the task is still sitting around from the last run, release it + if (asicTask!=nil) { + asicTask = nil; + } + + + + + + [self.prefs synchronize]; + + + self.noGPU = [self.prefs stringForKey:@"disableASICGPU"]; + self.debugOutputOn = [self.prefs stringForKey:@"debugASICOutput"]; + self.quietOutputOn = [self.prefs stringForKey:@"quietASICOutput"]; + self.bonusOptions = [self.prefs stringForKey:@"asicOptionsValue"]; + NSString *cpuThreads = [self.prefs stringForKey:@"cpuASICThreads"]; + + + + NSMutableArray *launchArray = [NSMutableArray arrayWithObjects: @"-T", @"--api-listen", @"--api-allow", @"W:0/0", nil]; + if ([self.bonusOptions isNotEqualTo:@""]) { + NSArray *deviceItems = [self.bonusOptions componentsSeparatedByString:@" "]; + + [launchArray addObjectsFromArray:deviceItems]; + } + + if ([cpuThreads isNotEqualTo:nil]) { + [launchArray addObject:@"-t"]; + [launchArray addObject:cpuThreads]; + } + else { + [launchArray addObject:@"-t"]; + [launchArray addObject:@"0"]; + } + + if ([self.debugOutputOn isNotEqualTo:nil]) { + [launchArray addObject:self.debugOutputOn]; + } + if ([self.quietOutputOn isNotEqualTo:nil]) { + [launchArray addObject:self.quietOutputOn]; + } + + if (self.bigpicEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"bigpic:all"]; + } + if (self.antminerEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"antminer:all"]; + } + if (self.bflEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"bfl:all"]; + } + if (self.bitfuryEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"bifury:all"]; + } + if (self.erupterEnable.state == NSOnState) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"erupter:all"]; + } + + + + if ([self.noGPU isNotEqualTo:nil]) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"opencl:auto"]; + } + + cpuThreads = nil; + + NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"]; + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSString *userpath = [paths objectAtIndex:0]; + userpath = [userpath stringByAppendingPathComponent:executableName]; // The file will go in this directory + NSString *saveBTCConfigFilePath = [userpath stringByAppendingPathComponent:@"bfgurls.conf"]; + + [launchArray addObject:@"-c"]; + [launchArray addObject:saveBTCConfigFilePath]; + + + + NSString *bundlePath2 = [[NSBundle mainBundle] resourcePath]; + + NSString *bfgPath = [bundlePath2 stringByAppendingString:@"/bfgminer/bin/bfgminer"]; + + [self.asicOutputView setString:@""]; + + asicTask =[[TaskWrapper alloc] initWithCommandPath:bfgPath + arguments:launchArray + environment:nil + delegate:self]; + // kick off the process asynchronously + + [asicTask startTask]; + + } if ([appDelegate.mobileMinerStatus isEqualToString:@"RESTART"]) { [self start:nil]; appDelegate.mobileMinerStatus = @"NONE"; } if ([appDelegate.mobileMinerStatus isEqualToString:@"STOP"]) { - [self stopAsicMiner]; +// [self stopAsicMiner]; appDelegate.mobileMinerStatus = @"NONE"; + + [self.asicStartButton setTitle:@"Start"]; + self.asicStartButton.tag = 1; + // [self stopToggling]; + // This stops the task and calls our callback (-processFinished) + [asicTask stopTask]; + findRunning=NO; + + // Release the memory for this wrapper object + + asicTask=nil; + + + appDelegate.mobileMinerStatus = @"NONE"; + + [appDelegate.asicReadBack setHidden:YES]; + [appDelegate.asicReading setHidden:YES]; + [[NSApp dockTile] display]; + } NSRange range = NSMakeRange(0, [[self.apiTableViewController arrangedObjects] count]); @@ -698,7 +945,8 @@ - (void)taskTwoWrapper:(taskTwoWrapper *)taskTwoWrapper didFinishTaskWithStatus: - (void)stopToggling { - [toggleTimer invalidate], toggleTimer = nil; // you don't want dangling pointers... + [loopTimer invalidate], loopTimer = nil; // you don't want dangling pointers... + // perform any other needed house-keeping here [self.asicStartButton setTitle:@"Start"]; } @@ -706,13 +954,17 @@ - (void)stopToggling - (void)startToggling { + [timerTimer invalidate], timerTimer = nil; + [loopTimer invalidate], loopTimer = nil; // you don't want dangling pointers... // if ([asicStartButton.title isEqual: @"Start"]) { // [asicStartButton setTitle:@"Stop"]; // [self stopToggling:self]; - toggleTimer = [NSTimer scheduledTimerWithTimeInterval:5. target:self selector:@selector(toggleTimerFired:) userInfo:nil repeats:YES]; + loopTimer = [NSTimer scheduledTimerWithTimeInterval:5. target:self selector:@selector(toggleLoopTimerFired:) userInfo:nil repeats:YES]; + timerTimer = [NSTimer scheduledTimerWithTimeInterval:5. target:self selector:@selector(toggleTimerFired:) userInfo:nil repeats:YES]; + // } diff --git a/MacMiner/bfgminerViewController.m b/MacMiner/bfgminerViewController.m index 5e1a25b..fb8fa13 100644 --- a/MacMiner/bfgminerViewController.m +++ b/MacMiner/bfgminerViewController.m @@ -628,7 +628,261 @@ -(void)viewDidLoad self.speedRead.tag = 0; bfgTask=nil; + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs synchronize]; + if ([[prefs objectForKey:@"startBfg"] isEqualToString:@"start"]) { + [self.bfgStartButton setTitle:@"Stop"]; + // If the task is still sitting around from the last run, release it + if (bfgTask!=nil) { + bfgTask = nil; + } + + + AppDelegate *appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate]; + appDelegate.bfgReading.stringValue = @""; + [appDelegate.bfgReadBack setHidden:NO]; + [appDelegate.bfgReading setHidden:NO]; + + + [[NSApp dockTile] display]; + + + // Let's allocate memory for and initialize a new TaskWrapper object, passing + // in ourselves as the controller for this TaskWrapper object, the path + // to the command-line tool, and the contents of the text field that + // displays what the user wants to search on + + // AppDelegate *appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate]; + + + NSString *bundlePath2 = [[NSBundle mainBundle] resourcePath]; + + NSString *bfgPath = [bundlePath2 stringByAppendingString:@"/bfgminer/bin/bfgminer"]; + + + + [self.bfgOutputView setString:@""]; + NSString *startingText = @"Starting…"; + self.bfgStatLabel.stringValue = startingText; + startingText = nil; + + + NSMutableArray *launchArray = [NSMutableArray arrayWithObjects: nil]; + + + + self.intensityValue = [prefs stringForKey:@"intenseValue"]; + self.worksizeValue = [prefs stringForKey:@"worksizeValue"]; + self.vectorValue = [prefs stringForKey:@"vectorValue"]; + self.noGPU = [prefs stringForKey:@"disableGPU"]; + self.onScrypt = [prefs stringForKey:@"useScrypt"]; + self.debugOutputOn = [prefs stringForKey:@"debugOutput"]; + self.quietOutputOn = [prefs stringForKey:@"quietOutput"]; + self.bonusOptions = [prefs stringForKey:@"bfgOptionsValue"]; + self.threadConc = [prefs stringForKey:@"bfgThreadConc"]; + self.shaders = [prefs stringForKey:@"bfgShaders"]; + self.lookupGap = [prefs stringForKey:@"bfgLookupGap"]; + NSString *cpuThreads = [prefs stringForKey:@"bfgCpuThreads"]; + + + [launchArray addObject:@"-T"]; + + if ([self.intensityValue isNotEqualTo:nil]) { + [launchArray addObject:@"-I"]; + [launchArray addObject:self.intensityValue]; + } + if ([self.worksizeValue isNotEqualTo:nil]) { + [launchArray addObject:@"-w"]; + [launchArray addObject:self.worksizeValue]; + } + if ([self.vectorValue isNotEqualTo:nil]) { + [launchArray addObject:@"-v"]; + [launchArray addObject:self.vectorValue]; + } + if (self.noGPU.length >= 1) { + [launchArray addObject:@"-S"]; + [launchArray addObject:@"opencl:auto"]; + } + if ([self.onScrypt isNotEqualTo:nil]) { + [launchArray addObject:self.onScrypt]; + } + if ([self.debugOutputOn isNotEqualTo:nil]) { + [launchArray addObject:self.debugOutputOn]; + } + if ([self.quietOutputOn isNotEqualTo:nil]) { + [launchArray addObject:self.quietOutputOn]; + } + if (self.threadConc.length >= 1) { + [launchArray addObject:@"--thread-concurrency"]; + [launchArray addObject:self.threadConc]; + } + if (self.shaders.length >= 1) { + [launchArray addObject:@"--shaders"]; + [launchArray addObject:self.shaders]; + } + if (self.lookupGap.length >= 1) { + [launchArray addObject:@"--lookup-gap"]; + [launchArray addObject:self.lookupGap]; + } + if (cpuThreads.length >= 1) { + [launchArray addObject:@"-t"]; + [launchArray addObject:cpuThreads]; + } + else { + [launchArray addObject:@"-t"]; + [launchArray addObject:@"0"]; + } + + self.executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"]; + self.paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + self.userpath = [self.paths objectAtIndex:0]; + self.userpath2 = [self.userpath stringByAppendingPathComponent:self.executableName]; // The file will go in this directory + self.saveBTCConfigFilePath = [self.userpath2 stringByAppendingPathComponent:@"bfgurls.conf"]; + self.saveLTCConfigFilePath = [self.userpath2 stringByAppendingPathComponent:@"ltcurls.conf"]; + self.userpath = nil; + self.userpath2 = nil; + self.paths = nil; + self.executableName = nil; + + [launchArray addObject:@"-c"]; + [launchArray addObject:self.saveBTCConfigFilePath]; + + if ([self.onScrypt isEqualTo:@"--scrypt"]) { + [launchArray removeLastObject]; + [launchArray addObject:self.saveLTCConfigFilePath]; + } + + if ([self.bonusOptions isNotEqualTo:nil]) { + NSArray *bonusStuff = [self.bonusOptions componentsSeparatedByString:@" "]; + if (bonusStuff.count >= 2) { + [launchArray addObjectsFromArray:bonusStuff]; + bonusStuff = nil; + } + } + + // NSString *testString = [launchArray componentsJoinedByString:@" "]; + // NSLog(testString); + + bfgTask=[[TaskWrapper alloc] initWithCommandPath:bfgPath + arguments:launchArray + environment:nil + delegate:self]; + + // kick off the process asynchronously + [bfgTask startTask]; + + NSString *logItString = [launchArray componentsJoinedByString:@"_"]; + appDelegate.bfgSettingText.stringValue = logItString; + appDelegate = nil; + + self.lookupGap = nil; + self.shaders = nil; + self.threadConc = nil; + + + BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:self.saveBTCConfigFilePath]; + if (fileExists) { + NSString *btcConfig = [NSString stringWithContentsOfFile : self.saveBTCConfigFilePath encoding:NSUTF8StringEncoding error:nil]; + NSString *ltcConfig = [NSString stringWithContentsOfFile : self.saveLTCConfigFilePath encoding:NSUTF8StringEncoding error:nil]; + + + if ([self.onScrypt length] <= 1) { + NSString *numberString = [self getDataBetweenFromString:btcConfig + leftString:@"url" rightString:@"," leftOffset:8]; + NSString *bfgURLValue = [numberString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + numberString = nil; + NSString *acceptString = [self getDataBetweenFromString:btcConfig + leftString:@"user" rightString:@"," leftOffset:9]; + NSString *bfgUserValue = [acceptString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + acceptString = nil; + + + NSAlert *startAlert = [[NSAlert alloc] init]; + [startAlert addButtonWithTitle:@"Indeed"]; + + [startAlert setMessageText:@"bfgminer has started"]; + NSString *infoText = [@"The primary pool is set to " stringByAppendingString:bfgURLValue]; + NSString *infoText2 = [infoText stringByAppendingString:@" and the user is set to "]; + NSString *infoText3 = [infoText2 stringByAppendingString:bfgUserValue]; + [startAlert setInformativeText:infoText3]; + + infoText3 = nil; + infoText2 = nil; + infoText = nil; + + // [[NSAlert init] alertWithMessageText:@"This app requires python pip. Click 'Install' and you will be asked your password so it can be installed, or click 'Quit' and install pip yourself before relaunching this app." defaultButton:@"Install" alternateButton:@"Quit" otherButton:nil informativeTextWithFormat:nil]; + // NSAlertDefaultReturn = [self performSelector:@selector(installPip:)]; + [startAlert setAlertStyle:NSWarningAlertStyle]; + // returnCode: (NSInteger)returnCode + + [startAlert beginSheetModalForWindow:self.bfgWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; + } + + // if ([ltcConfig rangeOfString:stringUser].location != NSNotFound) { + if ([self.onScrypt isEqualTo:@"--scrypt"]) { + NSString *numberString = [self getDataBetweenFromString:ltcConfig + leftString:@"url" rightString:@"," leftOffset:8]; + NSString *bfgURLValue = [numberString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + numberString = nil; + NSString *acceptString = [self getDataBetweenFromString:ltcConfig + leftString:@"user" rightString:@"," leftOffset:9]; + NSString *bfgUserValue = [acceptString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + acceptString = nil; + + + NSAlert *startAlert = [[NSAlert alloc] init]; + [startAlert addButtonWithTitle:@"Indeed"]; + + [startAlert setMessageText:@"bfgminer has started"]; + NSString *infoText = [@"The primary pool is set to " stringByAppendingString:bfgURLValue]; + NSString *infoText2 = [infoText stringByAppendingString:@" and the user is set to "]; + NSString *infoText3 = [infoText2 stringByAppendingString:bfgUserValue]; + [startAlert setInformativeText:infoText3]; + + infoText3 = nil; + infoText2 = nil; + infoText = nil; + ltcConfig = nil; + btcConfig = nil; + bfgURLValue = nil; + bfgUserValue = nil; + + + // [[NSAlert init] alertWithMessageText:@"This app requires python pip. Click 'Install' and you will be asked your password so it can be installed, or click 'Quit' and install pip yourself before relaunching this app." defaultButton:@"Install" alternateButton:@"Quit" otherButton:nil informativeTextWithFormat:nil]; + // NSAlertDefaultReturn = [self performSelector:@selector(installPip:)]; + [startAlert setAlertStyle:NSWarningAlertStyle]; + // returnCode: (NSInteger)returnCode + + [startAlert beginSheetModalForWindow:self.bfgWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; + + } + + + } + + + + + + + launchArray = nil; + + self.intensityValue = nil; + self.worksizeValue = nil; + self.vectorValue = nil; + self.noGPU = nil; + self.onScrypt = nil; + self.debugOutputOn = nil; + self.quietOutputOn = nil; + self.bonusOptions = nil; + + bfgPath = nil; + self.saveBTCConfigFilePath = nil; + self.saveLTCConfigFilePath = nil; + } + prefs = nil; } - (IBAction)bfgMinerToggle:(id)sender { diff --git a/MacMiner/cgminerViewController.m b/MacMiner/cgminerViewController.m index 84d0a3d..9730293 100644 --- a/MacMiner/cgminerViewController.m +++ b/MacMiner/cgminerViewController.m @@ -504,8 +504,173 @@ -(void)viewDidLoad // [[NSApp dockTile] setContentView:cgdockReading]; // [[NSApp dockTile] display]; + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + [prefs synchronize]; + if ([[prefs objectForKey:@"startCg"] isEqualToString:@"start"]) { + [self.cgStartButton setTitle:@"Stop"]; + // If the task is still sitting around from the last run, release it + if (cgTask!=nil) { + cgTask = nil; + } + + NSString *filePath = @"/System/Library/Extensions/IOUSBFamily.kext"; + bool b=[[NSFileManager defaultManager] fileExistsAtPath:filePath]; + + NSString *filePath2 = @"/System/Library/Extensions/SiLabsUSBDriver64.kext"; + bool c=[[NSFileManager defaultManager] fileExistsAtPath:filePath2]; + + NSString *filePath3 = @"/System/Library/Extensions/FTDIUSBSerialDriver.kext"; + bool d=[[NSFileManager defaultManager] fileExistsAtPath:filePath3]; + + if (b == YES || c == YES || d == YES) { + NSAlert *driverAlert = [[NSAlert alloc] init]; + [driverAlert addButtonWithTitle:@"Show Instructions"]; + [driverAlert addButtonWithTitle:@"Ignore problem drivers"]; + + [driverAlert setMessageText:@"Driver problem detected"]; + NSString *infoText = @"cgminer conflicts with the native Mac OS 10.9 and other USB Serial drivers. Please click below to see instructions for disabling the default driver."; + + [driverAlert setInformativeText:infoText]; + + + [driverAlert setAlertStyle:NSWarningAlertStyle]; + // returnCode: (NSInteger)returnCode + int rCode = [driverAlert runModal]; + if (rCode == NSAlertFirstButtonReturn) { + + if (b == YES) { + NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; + NSString *urlPath = [bundlePath stringByAppendingString:@"/driverfiles/Instructions.rtf"]; + NSURL* url = [NSURL fileURLWithPath:urlPath isDirectory:YES]; + + NSArray *fileURLs = [NSArray arrayWithObjects:url, nil]; + [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs]; + } + + } + else { + // NSLog(@"Ignore"); + } + + // [driverAlert beginSheetModalForWindow:self.cgWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; + + } + + + AppDelegate *appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate]; + appDelegate.cgReading.stringValue = @""; + [appDelegate.cgReadBack setHidden:NO]; + [appDelegate.cgReading setHidden:NO]; + + [[NSApp dockTile] display]; + + NSString *bundlePath2 = [[NSBundle mainBundle] resourcePath]; + + NSString *cgPath = [bundlePath2 stringByAppendingString:@"/cgminer/bin/cgminer"]; + + + // NSString *cgPath = @"/Applications/MacMiner.app/Contents/Resources/cgminer/bin/cgminer"; + + // NSLog(poclbmPath); + [self.cgOutputView setString:@""]; + NSString *startingText = @"Starting…"; + self.cgStatLabel.stringValue = startingText; + startingText = nil; + + + NSMutableArray *launchArray = [NSMutableArray arrayWithObjects: nil]; + + + NSString *bonusOptions = [prefs stringForKey:@"cgOptionsValue"]; + + + [launchArray addObject:@"-T"]; + [launchArray addObject:@"--api-listen"]; + [launchArray addObject:@"--api-allow"]; + [launchArray addObject:@"W:0/0"]; + [launchArray addObject:@"--api-port"]; + [launchArray addObject:@"4048"]; + + + NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"]; + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSString *userpath = [paths objectAtIndex:0]; + userpath = [userpath stringByAppendingPathComponent:executableName]; // The file will go in this directory + NSString *saveBTCConfigFilePath = [userpath stringByAppendingPathComponent:@"bfgurls.conf"]; + // NSString *saveLTCConfigFilePath = [userpath stringByAppendingPathComponent:@"ltcurls.conf"]; + + [launchArray addObject:@"-c"]; + [launchArray addObject:saveBTCConfigFilePath]; + + + if ([bonusOptions isNotEqualTo:nil]) { + NSArray *bonusStuff = [bonusOptions componentsSeparatedByString:@" "]; + if (bonusStuff.count >= 2) { + [launchArray addObjectsFromArray:bonusStuff]; + bonusStuff = nil; + } + } + + + cgTask=[[TaskWrapper alloc] initWithCommandPath:cgPath + arguments:launchArray + environment:nil + delegate:self]; + + // kick off the process asynchronously + [cgTask startTask]; + + + BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:saveBTCConfigFilePath]; + if (fileExists) { + NSString *btcConfig = [NSString stringWithContentsOfFile : saveBTCConfigFilePath encoding:NSUTF8StringEncoding error:nil]; + + + NSString *numberString = [self getDataBetweenFromString:btcConfig + leftString:@"url" rightString:@"," leftOffset:8]; + NSString *bfgURLValue = [numberString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + numberString = nil; + NSString *acceptString = [self getDataBetweenFromString:btcConfig + leftString:@"user" rightString:@"," leftOffset:9]; + NSString *bfgUserValue = [acceptString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + acceptString = nil; + + + NSAlert *startAlert = [[NSAlert alloc] init]; + [startAlert addButtonWithTitle:@"Indeed"]; + + [startAlert setMessageText:@"cgminer has started"]; + NSString *infoText = @"The primary pool is set to "; + infoText = [infoText stringByAppendingString:bfgURLValue]; + infoText = [infoText stringByAppendingString:@" and the user is set to "]; + infoText = [infoText stringByAppendingString:bfgUserValue]; + [startAlert setInformativeText:infoText]; + + // [[NSAlert init] alertWithMessageText:@"This app requires python pip. Click 'Install' and you will be asked your password so it can be installed, or click 'Quit' and install pip yourself before relaunching this app." defaultButton:@"Install" alternateButton:@"Quit" otherButton:nil informativeTextWithFormat:nil]; + // NSAlertDefaultReturn = [self performSelector:@selector(installPip:)]; + [startAlert setAlertStyle:NSWarningAlertStyle]; + // returnCode: (NSInteger)returnCode + + [startAlert beginSheetModalForWindow:self.cgWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; + + + // if ([ltcConfig rangeOfString:stringUser].location != NSNotFound) { + + } + + + + + launchArray = nil; + + bonusOptions = nil; + cgPath = nil; + + } + + prefs = nil; } diff --git a/MacMiner/cpuminerViewController.m b/MacMiner/cpuminerViewController.m index ed0bbd4..a5d075d 100644 --- a/MacMiner/cpuminerViewController.m +++ b/MacMiner/cpuminerViewController.m @@ -27,7 +27,165 @@ - (id)initWithCoder:(NSCoder *)aDecoder self.cpuOutputView.delegate = self; self.cpuStatLabel.delegate = self; + + + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + [prefs synchronize]; + + if ([[prefs objectForKey:@"startBfg"] isEqualToString:@"start"]) { + [self.cpuStartButton setTitle:@"Stop"]; + // If the task is still sitting around from the last run, release it + if (cpuTask!=nil) { + cpuTask = nil; + } + + + + AppDelegate *appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate]; + appDelegate.cpuReading.stringValue = @""; + [appDelegate.cpuReadBack setHidden:NO]; + [appDelegate.cpuReading setHidden:NO]; + + [[NSApp dockTile] display]; + + + + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs synchronize]; + + + NSString *mainLTCPool = [prefs stringForKey:@"defaultLTCPoolValue"]; + NSString *mainLTCUser = [prefs stringForKey:@"defaultLTCUser"]; + NSString *mainLTCPass = [prefs stringForKey:@"defaultLTCPass"]; + + + NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"]; + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSString *userpath = [paths objectAtIndex:0]; + userpath = [userpath stringByAppendingPathComponent:executableName]; // The file will go in this directory + NSString *saveLTCConfigFilePath = [userpath stringByAppendingPathComponent:@"ltcurls.conf"]; + + + NSString *stringUser = [[NSString alloc] initWithContentsOfFile:saveLTCConfigFilePath encoding:NSUTF8StringEncoding error:nil]; + NSString *userFind = @"user"; + if ([stringUser rangeOfString:userFind].location != NSNotFound) { + NSString *foundURLString = [self getDataBetweenFromString:stringUser + leftString:@"url" rightString:@"," leftOffset:8]; + NSString *URLClean = foundURLString; + mainLTCPool = [URLClean stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + NSString *foundUserString = [self getDataBetweenFromString:stringUser + leftString:@"user" rightString:@"," leftOffset:8]; + NSString *stepClean = foundUserString; + mainLTCUser = [stepClean stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + + NSString *foundPassString = [self getDataBetweenFromString:stringUser + leftString:@"pass" rightString:@"\"" leftOffset:9]; + NSString *passClean = foundPassString; + mainLTCPass = [passClean stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + } + + + + NSString *cpuThreadsV = [prefs stringForKey:@"cpuThreadsValue"]; + // NSString *cpuScryptV = [prefs stringForKey:@"cpuUseScryptValue"]; + NSString *cpuQuietV = [prefs stringForKey:@"cpuQuietOutput"]; + NSString *cpuDebugV = [prefs stringForKey:@"cpuDebugOutput"]; + NSString *cpuOptionsV = [prefs stringForKey:@"cpuOptionsValue"]; + + + NSMutableArray *cpuLaunchArray = [NSMutableArray arrayWithObjects: nil]; + + if ([cpuThreadsV isNotEqualTo:@""]) { + [cpuLaunchArray addObject:@"-t"]; + [cpuLaunchArray addObject:cpuThreadsV]; + } + + [cpuLaunchArray addObject:@"-o"]; + [cpuLaunchArray addObject:mainLTCPool]; + [cpuLaunchArray addObject:@"-u"]; + [cpuLaunchArray addObject:mainLTCUser]; + [cpuLaunchArray addObject:@"-p"]; + [cpuLaunchArray addObject:mainLTCPass]; + + if ([cpuQuietV isNotEqualTo:nil]) { + [cpuLaunchArray addObject:@"-q"]; + } + if ([cpuDebugV isNotEqualTo:nil]) { + [cpuLaunchArray addObject:@"-D"]; + } + + + if ([cpuOptionsV isNotEqualTo:nil]) { + NSArray *cpuBonusStuff = [cpuOptionsV componentsSeparatedByString:@" "]; + if (cpuBonusStuff.count >= 2) { + [cpuLaunchArray addObjectsFromArray:cpuBonusStuff]; + cpuBonusStuff = nil; + } + } + + + NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; + NSString *cpuPath = [bundlePath stringByDeletingLastPathComponent]; + + NSString *cpuPath2 = [cpuPath stringByAppendingString:@"/Resources/minerd"]; + // NSLog(cpuPath); + [self.cpuOutputView setString:@""]; + NSString *startingText = @"Starting…"; + self.cpuStatLabel.stringValue = startingText; + + + cpuTask = [[TaskWrapper alloc] initWithCommandPath:cpuPath2 + arguments:cpuLaunchArray + environment:nil + delegate:self]; + + [cpuTask startTask]; + + BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:saveLTCConfigFilePath]; + if (fileExists) { + + NSString *ltcConfig = [NSString stringWithContentsOfFile : saveLTCConfigFilePath encoding:NSUTF8StringEncoding error:nil]; + + + + + NSString *numberString = [self getDataBetweenFromString:ltcConfig + leftString:@"url" rightString:@"," leftOffset:8]; + NSString *bfgURLValue = [numberString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + numberString = nil; + NSString *acceptString = [self getDataBetweenFromString:ltcConfig + leftString:@"user" rightString:@"," leftOffset:9]; + NSString *bfgUserValue = [acceptString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; + acceptString = nil; + + + NSAlert *startAlert = [[NSAlert alloc] init]; + [startAlert addButtonWithTitle:@"Indeed"]; + + [startAlert setMessageText:@"cpuminer has started"]; + NSString *infoText = [@"The primary pool is set to " stringByAppendingString:bfgURLValue]; + + NSString *infoText2 = [infoText stringByAppendingString:@" and the user is set to "]; + NSString *infoText3 = [infoText2 stringByAppendingString:bfgUserValue]; + [startAlert setInformativeText:infoText3]; + infoText = nil; + infoText2 = nil; + infoText3 = nil; + + + [startAlert setAlertStyle:NSWarningAlertStyle]; + // returnCode: (NSInteger)returnCode + + [startAlert beginSheetModalForWindow:self.cpuWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; + + } + + + + + } } diff --git a/MacMiner/en.lproj/MainMenu.xib b/MacMiner/en.lproj/MainMenu.xib index a874584..5f02159 100644 --- a/MacMiner/en.lproj/MainMenu.xib +++ b/MacMiner/en.lproj/MainMenu.xib @@ -512,9 +512,13 @@ + + + + @@ -582,7 +586,7 @@ - + @@ -602,9 +606,12 @@ - + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + @@ -852,7 +936,7 @@ - + @@ -1008,7 +1092,7 @@ - + @@ -1165,7 +1249,7 @@ - + @@ -1183,7 +1267,7 @@ - + @@ -2611,7 +2695,7 @@ Gw - + @@ -2973,7 +3057,7 @@ Gw - + @@ -3379,7 +3463,7 @@ Gw - + @@ -3389,7 +3473,7 @@ Gw - + @@ -3712,7 +3796,7 @@ Gw - + @@ -3768,7 +3852,7 @@ Gw Special thanks to Scott Holben -for his help with this version +for his help with C/C++ code @@ -3776,7 +3860,7 @@ for his help with this version - + @@ -3785,7 +3869,7 @@ for his help with this version - + @@ -3794,7 +3878,7 @@ for his help with this version - + @@ -3842,7 +3926,7 @@ for his help with this version - + diff --git a/MacMiner/preferencesViewController.h b/MacMiner/preferencesViewController.h index c88a419..6384905 100644 --- a/MacMiner/preferencesViewController.h +++ b/MacMiner/preferencesViewController.h @@ -24,6 +24,12 @@ @property (nonatomic, weak) IBOutlet NSButton *scrollButton; @property (nonatomic, weak) IBOutlet NSButton *dockButton; @property (nonatomic, weak) IBOutlet NSButton *speechButton; +@property (nonatomic, weak) IBOutlet NSButton *fpgaAsicButton; +@property (nonatomic, weak) IBOutlet NSButton *bfgButton; +@property (nonatomic, weak) IBOutlet NSButton *cgButton; +@property (nonatomic, weak) IBOutlet NSButton *cpuButton; +@property (nonatomic, weak) IBOutlet NSButton *commandButton; +@property (nonatomic, weak) IBOutlet NSButton *httpButton; -(IBAction)preferenceToggle:(id)sender; diff --git a/MacMiner/preferencesViewController.m b/MacMiner/preferencesViewController.m index 7f21ea7..3a6c993 100644 --- a/MacMiner/preferencesViewController.m +++ b/MacMiner/preferencesViewController.m @@ -19,12 +19,14 @@ @implementation preferencesViewController - (id)initWithCoder:(NSCoder *)aDecoder { - + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; [prefs synchronize]; self.charCount.stringValue = [prefs objectForKey:@"logLength" ]; + + prefs = nil; return self; @@ -39,12 +41,78 @@ -(IBAction)preferenceToggle:(id)sender { NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + [prefs setObject:self.charCount.stringValue forKey:@"logLength"]; [prefs synchronize]; prefs = nil; + if (self.fpgaAsicButton.state == NSOnState) { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs setObject:@"start" forKey:@"startAsic"]; + + [prefs synchronize]; + prefs = nil; + } + if (self.fpgaAsicButton.state == NSOffState) { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs setObject:nil forKey:@"startAsic"]; + + [prefs synchronize]; + prefs = nil; + } + if (self.bfgButton.state == NSOnState) { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs setObject:@"start" forKey:@"startBfg"]; + + [prefs synchronize]; + prefs = nil; + } + if (self.bfgButton.state == NSOffState) { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs setObject:nil forKey:@"startBfg"]; + + [prefs synchronize]; + prefs = nil; + } + if (self.cgButton.state == NSOnState) { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs setObject:@"start" forKey:@"startCg"]; + + [prefs synchronize]; + prefs = nil; + } + if (self.cgButton.state == NSOffState) { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs setObject:nil forKey:@"startCg"]; + + [prefs synchronize]; + prefs = nil; + } + if (self.cpuButton.state == NSOnState) { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs setObject:@"start" forKey:@"startCpu"]; + + [prefs synchronize]; + prefs = nil; + } + if (self.cpuButton.state == NSOffState) { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + + [prefs setObject:nil forKey:@"startCpu"]; + + [prefs synchronize]; + prefs = nil; + } + if (self.dockButton.state == NSOffState) { NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; @@ -128,6 +196,33 @@ -(IBAction)preferenceToggle:(id)sender { self.dockButton.state = NSOffState; } + + if ([[prefs objectForKey:@"startAsic"] isEqualToString:@"start"]) { + self.fpgaAsicButton.state = NSOnState; + } + else { + self.fpgaAsicButton.state = NSOffState; + } + if ([[prefs objectForKey:@"startBfg"] isEqualToString:@"start"]) { + self.bfgButton.state = NSOnState; + } + else { + self.bfgButton.state = NSOffState; + } + if ([[prefs objectForKey:@"startCg"] isEqualToString:@"start"]) { + self.cgButton.state = NSOnState; + } + else { + self.cgButton.state = NSOffState; + } + if ([[prefs objectForKey:@"startCpu"] isEqualToString:@"start"]) { + self.cpuButton.state = NSOnState; + } + else { + self.cpuButton.state = NSOffState; + } + + self.emailAddress.stringValue = [prefs objectForKey:@"emailAddress"]; self.appID.stringValue = [prefs objectForKey:@"appID"]; @@ -232,4 +327,5 @@ - (IBAction)showGeneral:(id)sender { [self.prefView2 setHidden:YES]; } + @end diff --git a/bfgminer/bin/bfgminer b/bfgminer/bin/bfgminer index 160e52b..870b8a2 100755 Binary files a/bfgminer/bin/bfgminer and b/bfgminer/bin/bfgminer differ diff --git a/bfgminer/lib/libevent-2.0.5.dylib b/bfgminer/lib/libevent-2.0.5.dylib index 3747ff2..9a94822 100755 Binary files a/bfgminer/lib/libevent-2.0.5.dylib and b/bfgminer/lib/libevent-2.0.5.dylib differ diff --git a/bfgminer/lib/libevent.a b/bfgminer/lib/libevent.a index adf549a..2d7a9e4 100644 Binary files a/bfgminer/lib/libevent.a and b/bfgminer/lib/libevent.a differ diff --git a/bfgminer/lib/libevent_core-2.0.5.dylib b/bfgminer/lib/libevent_core-2.0.5.dylib index fdebd7c..a2c863b 100755 Binary files a/bfgminer/lib/libevent_core-2.0.5.dylib and b/bfgminer/lib/libevent_core-2.0.5.dylib differ diff --git a/bfgminer/lib/libevent_core.a b/bfgminer/lib/libevent_core.a index efc7c5e..70d7fbc 100644 Binary files a/bfgminer/lib/libevent_core.a and b/bfgminer/lib/libevent_core.a differ diff --git a/bfgminer/lib/libevent_extra-2.0.5.dylib b/bfgminer/lib/libevent_extra-2.0.5.dylib index f3247f9..88f6e47 100755 Binary files a/bfgminer/lib/libevent_extra-2.0.5.dylib and b/bfgminer/lib/libevent_extra-2.0.5.dylib differ diff --git a/bfgminer/lib/libevent_extra.a b/bfgminer/lib/libevent_extra.a index ba74cba..e00aeb4 100644 Binary files a/bfgminer/lib/libevent_extra.a and b/bfgminer/lib/libevent_extra.a differ diff --git a/bfgminer/lib/libevent_openssl-2.0.5.dylib b/bfgminer/lib/libevent_openssl-2.0.5.dylib index ba29f50..3edbc42 100755 Binary files a/bfgminer/lib/libevent_openssl-2.0.5.dylib and b/bfgminer/lib/libevent_openssl-2.0.5.dylib differ diff --git a/bfgminer/lib/libevent_openssl.a b/bfgminer/lib/libevent_openssl.a index 629fdf2..de650ec 100644 Binary files a/bfgminer/lib/libevent_openssl.a and b/bfgminer/lib/libevent_openssl.a differ diff --git a/bfgminer/lib/libevent_pthreads-2.0.5.dylib b/bfgminer/lib/libevent_pthreads-2.0.5.dylib index 290140d..56ccd22 100755 Binary files a/bfgminer/lib/libevent_pthreads-2.0.5.dylib and b/bfgminer/lib/libevent_pthreads-2.0.5.dylib differ diff --git a/bfgminer/lib/libevent_pthreads.a b/bfgminer/lib/libevent_pthreads.a index c503447..c7d2f9b 100644 Binary files a/bfgminer/lib/libevent_pthreads.a and b/bfgminer/lib/libevent_pthreads.a differ diff --git a/bfgminer/lib/libjansson.4.dylib b/bfgminer/lib/libjansson.4.dylib index 3a0f43e..d6187f0 100755 Binary files a/bfgminer/lib/libjansson.4.dylib and b/bfgminer/lib/libjansson.4.dylib differ diff --git a/bfgminer/lib/libjansson.a b/bfgminer/lib/libjansson.a index 4cd2a1a..7e363d4 100644 Binary files a/bfgminer/lib/libjansson.a and b/bfgminer/lib/libjansson.a differ diff --git a/bfgminer/lib/libmicrohttpd.10.dylib b/bfgminer/lib/libmicrohttpd.10.dylib index 41c53a1..2def9f9 100755 Binary files a/bfgminer/lib/libmicrohttpd.10.dylib and b/bfgminer/lib/libmicrohttpd.10.dylib differ diff --git a/bfgminer/lib/libmicrohttpd.a b/bfgminer/lib/libmicrohttpd.a index e71181c..1c5836b 100644 Binary files a/bfgminer/lib/libmicrohttpd.a and b/bfgminer/lib/libmicrohttpd.a differ diff --git a/bfgminer/lib/libusb-1.0.2.dylib b/bfgminer/lib/libusb-1.0.2.dylib index 66c02e1..5390891 100755 Binary files a/bfgminer/lib/libusb-1.0.2.dylib and b/bfgminer/lib/libusb-1.0.2.dylib differ diff --git a/bfgminer/lib/libusb-1.0.a b/bfgminer/lib/libusb-1.0.a index 7c4526e..41eff82 100644 Binary files a/bfgminer/lib/libusb-1.0.a and b/bfgminer/lib/libusb-1.0.a differ diff --git a/bfgminer/share/doc/bfgminer/AUTHORS b/bfgminer/share/doc/bfgminer/AUTHORS index 78e8ac5..8ab8579 100644 --- a/bfgminer/share/doc/bfgminer/AUTHORS +++ b/bfgminer/share/doc/bfgminer/AUTHORS @@ -1,7 +1,8 @@ FPGA/ASIC mining and refactor: Luke Dashjr 1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh GPU mining and refactor: Con Kolivas 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ +AntMiner driver: Nate Woolls and Lingchao Xu Bitfury GPIO-based drivers: Bitfury and Anatoly Legkodymov -Big Picture Mining driver: Andreas Auer +Big Picture Mining and TwinFury drivers: Andreas Auer Avalon and Icarus drivers: Xiangfu ZTEX FPGA driver: Nelisky Original CPU mining software: Jeff Garzik @@ -12,7 +13,6 @@ Ubuntu packaging: Graeme Humphries Contributors: -Nate Woolls Jason Hughes Ycros Denis Ahrens diff --git a/bfgminer/share/doc/bfgminer/NEWS b/bfgminer/share/doc/bfgminer/NEWS index 8d5ae40..4094865 100644 --- a/bfgminer/share/doc/bfgminer/NEWS +++ b/bfgminer/share/doc/bfgminer/NEWS @@ -1,3 +1,96 @@ +BFGMiner Version 3.10.0 - January 15, 2014 + +- Downgrade official Windows build compiler to GCC 4.7.3. +- Bugfix: Stratum: Accept JSON Number type for port number +- Bugfix: proxy: Set start timer when creating new virtual devices +- antminer: Add support for the Identify function - flashes LED 10 times +- drillbit: Expand allowed external clock range to 0-255 +- drillbit: Forbid setting external clock usage if not supported by device +- Check for DBC_TEMP capability before trying to read temperature +- Bugfix: drillbit: Reduce work message to correct size +- README: Update documentation for new udev rules and "video" group +- Bugfix: opencl/adl: Set iSpeedType for get-fanspeed requests, and ensure we +don't change do something weird with the fan when initially setting user-defined +speed flag. +- Bugfix: drillbit: Initialise rv variable +- Bugfix: Simplify adding "http://" prefix to avoid strncat overflow (length +excludes null byte) +- hashfast: Debuglog work flushing +- hashfast: Implement OP_NONCE search flag +- hashfast: Log seq numbers for nonces found +- hashfast: Count hashes done by nonces found, rather than no-pending-work +(which could be triggered by flushes) +- hashfast: Just keep a queue of the 32 most recent work items per core +- hashfast: Convert to minerloop_queue driver model +- hashfast: Gracefully complain if we are given an unknown chip or core address +- udev rule for hashfast devices +- hashfast: New driver using UMS protocol +- CRC-8-CCITT implementation +- AUTHORS: Add Lingchao Xu and move nwoolls up to antminer driver (and mention +TwinFury driver for Andreas) +- knc: Workaround false compiler warning about "uninitialised" vars +- Bugfix: drillbit: Access fd after potentially reopening +- Remove Christmas colouring +- drillbit: Add udev rule +- drillbit: Correct configure logic to check for generic bitfury code (needed to +decode nonces) +- drillbit: Implement some basic problem recovery +- drillbit: Support identify command +- drillbit: Read/write access to clock and voltage configuration from RPC and +ManageTUI +- drillbit: Store board configuration +- drillbit: Read temperature sensor +- drillbit: Check nonces against prev work +- drillbit: Implement mining +- drillbit: Only detection code +- antminer: Initial support for the Bitmain AntMiner U1 ASIC Includes support +for identifying the U1 separately from Icarus and Block Erupter Also includes +overclocking via --set-device antminer:clock=xHEX +- Extend horizontal lines to full screen width +- Log devid for USB string request failures +- Bugfix: segmentation fault if the terminal window is too narrow for the Help +and Quit items +- Accept "address" spelled out in --coinbase-addr option +- Bugfix: document the need to package zlib1.dll in the Windows build +instructions +- Bugfix: Stratum: Re-read pool sock var after suspend+restart +- Silence false uninitialised var use warning and calculate dev_runtime only +once +- Bugfix: HID API not properly detected on Mac OS X +- Adjust device list size as necessary when accessing options +- Avoid erasing the screen when statusy is not changing +- Abstract common set_statusy code out of change_logwinsize and check_winsizes +- TUI: Support pgup/pgdown for scrolling device list by page +- Bugfix: icarus: quirk_reopen is an int +- Bugfix: Do not allocate spi_port on the Stack, even to initialize - +EXC_BAD_ACCESS on OS X +- get_statline3: Simplify statistics gathering +- Bugfix: twinfury: Use serial number formatted over USB, so it works with +--scan +- twinfury: Only debuglog temperature debugging data when --device-protocol-dump +is enabled +- Bugfix: twinfury: Populate temperature info on both processors +- Option --weighed-stats to display A and R values weighed by difficulty +- README.GPU: Document always-disabled-by-default for OpenCL driver +- AUTHORS: Add Nate Woolls +- Extend menu to full width of window +- Abstract out spaces-to-eol to bfg_wspctoeol function +- Elaborate on spi_port+stack problem in comments +- Bugfix: Do not allocate spi_port on the Stack - EXC_BAD_ACCESS on OS X +- Bugfix: don't attempt to probe Bluetooth devices when scanning hardware +- x6500: Allow overriding the maximum frequency used by the dynclock logic Can +now use e.g. --set-device x6500:maxclock=210 Prevents spending time on +frequencies that only produce HW errors +- HACKING: Clearly document that dname must be lowercase and alphabetic +- bifury: Tolerate corruption in submit message, remapping shares to the first +processor if chip id is unrecognised +- bifury: Tolerate corruption in hwerror message +- bifury: Tolerate corruption in job message, and only count hashes done when +completing a known job +- Use a lowercase driver name to fix --scan pattern matching Otherwise the +following doesn't work: -S noauto -S twinfury:auto + + BFGMiner Version 3.9.0 - December 25, 2013 - Update official Win32 build compiler and library: diff --git a/bfgminer/share/doc/bfgminer/README b/bfgminer/share/doc/bfgminer/README index 6d50262..5edbae2 100644 --- a/bfgminer/share/doc/bfgminer/README +++ b/bfgminer/share/doc/bfgminer/README @@ -329,8 +329,7 @@ See README.scrypt for more information regarding (non-bitcoin) scrypt mining. To use ASICs or FPGAs, you will need to be sure the user BFGMiner is running as has appropriate permissions. This varies by operating system. -On Gentoo: sudo usermod -a -G uucp -On Ubuntu: sudo usermod -a -G dialout +On Linux, with BFGMiner's udev rules: sudo usermod -a -G video Note that on GNU/Linux systems, you will usually need to login again before group changes take effect. @@ -799,17 +798,16 @@ original driver. Uninstalling the device (and WinUSB driver) from Device Manager and re-plugging it will usually trigger driver re-installation to the default drivers. -Q: On Linux I can see the /dev/ttyUSB* devices for my ICA/BFL/MMQ FPGA, but -BFGMiner can't mine on them? +Q: On Linux I can see the /dev/ttyUSB* devices, but BFGMiner can't mine on them? A: Make sure you have the required privileges to access the /dev/ttyUSB* devices: sudo ls -las /dev/ttyUSB* will give output like: - 0 crw-rw---- 1 root dialout 188, 0 2012-09-11 13:49 /dev/ttyUSB0 -This means your account must have the group 'dialout' or root privileges -To permanently give your account the 'dialout' group: - sudo usermod -G dialout -a `whoami` -Then logout and back in again + 0 crw-rw---- 1 root video 188, 0 2012-09-11 13:49 /dev/ttyUSB0 +This means your account must have the group 'video' or root privileges. +To permanently give your account the 'video' group: + sudo usermod -G video -a `whoami` +Then logout and back in again. Q: Can I mine scrypt with FPGAs or ASICs? A: Currently no. Bitcoin ASICs are only useful for SHA256d systems and FPGAs diff --git a/bfgminer3.9/bin/bfgminer b/bfgminer3.9/bin/bfgminer new file mode 100755 index 0000000..160e52b Binary files /dev/null and b/bfgminer3.9/bin/bfgminer differ diff --git a/bfgminer3.9/bin/bfgminer-rpc b/bfgminer3.9/bin/bfgminer-rpc new file mode 100755 index 0000000..8defe39 Binary files /dev/null and b/bfgminer3.9/bin/bfgminer-rpc differ diff --git a/bfgminer3.9/bin/bitforce-firmware-flash b/bfgminer3.9/bin/bitforce-firmware-flash new file mode 100755 index 0000000..d3c6824 Binary files /dev/null and b/bfgminer3.9/bin/bitforce-firmware-flash differ diff --git a/bfgminer3.9/bin/bitstreams/COPYING_fpgaminer b/bfgminer3.9/bin/bitstreams/COPYING_fpgaminer new file mode 100644 index 0000000..9db2c5f --- /dev/null +++ b/bfgminer3.9/bin/bitstreams/COPYING_fpgaminer @@ -0,0 +1,23 @@ +All the bitstream files included in this directory that follow the name pattern fpgaminer_*.ncd are: + +---- + +Copyright (c) 2011-2012 fpgaminer@bitcoin-mining.com + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +---- + +You can find the original sources at the Open Source FPGA Bitcoin Miner project GitHub repository: +https://github.com/progranism/Open-Source-FPGA-Bitcoin-Miner/tree/master/projects/X6000_ztex_comm4/hdl diff --git a/bfgminer3.9/bin/bitstreams/COPYING_ztex b/bfgminer3.9/bin/bitstreams/COPYING_ztex new file mode 100644 index 0000000..99cd2ed --- /dev/null +++ b/bfgminer3.9/bin/bitstreams/COPYING_ztex @@ -0,0 +1,24 @@ +All the bitstream files included in this directory that follow the name pattern ztex_*.bit are: + +---- + +Copyright (C) 2009-2011 ZTEX GmbH. +http://www.ztex.de + + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 3 as +published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, see http://www.gnu.org/licenses/. + +---- + +You can find the original sources at the BTCMiner project home page: http://www.ztex.de/btcminer/ + diff --git a/bfgminer3.9/bin/bitstreams/fpgaminer_top_fixed7_197MHz.ncd b/bfgminer3.9/bin/bitstreams/fpgaminer_top_fixed7_197MHz.ncd new file mode 100644 index 0000000..1df4e1d Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/fpgaminer_top_fixed7_197MHz.ncd differ diff --git a/bfgminer3.9/bin/bitstreams/fpgaminer_x6500-overclocker-0402.bit b/bfgminer3.9/bin/bitstreams/fpgaminer_x6500-overclocker-0402.bit new file mode 100644 index 0000000..de00ad5 Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/fpgaminer_x6500-overclocker-0402.bit differ diff --git a/bfgminer3.9/bin/bitstreams/ztex_ufm1_15b1.bit b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15b1.bit new file mode 100644 index 0000000..4ed6f4c Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15b1.bit differ diff --git a/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d1.bit b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d1.bit new file mode 100644 index 0000000..b87eaf4 Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d1.bit differ diff --git a/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d3.bit b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d3.bit new file mode 100644 index 0000000..78157a5 Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d3.bit differ diff --git a/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d4.bin b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d4.bin new file mode 100644 index 0000000..411c172 Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d4.bin differ diff --git a/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d4.bit b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d4.bit new file mode 100644 index 0000000..0951976 Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15d4.bit differ diff --git a/bfgminer3.9/bin/bitstreams/ztex_ufm1_15y1.bin b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15y1.bin new file mode 100644 index 0000000..f1532f0 Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15y1.bin differ diff --git a/bfgminer3.9/bin/bitstreams/ztex_ufm1_15y1.bit b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15y1.bit new file mode 100644 index 0000000..c9b38ae Binary files /dev/null and b/bfgminer3.9/bin/bitstreams/ztex_ufm1_15y1.bit differ diff --git a/bfgminer3.9/bin/diablo121016.cl b/bfgminer3.9/bin/diablo121016.cl new file mode 100755 index 0000000..7b3738b --- /dev/null +++ b/bfgminer3.9/bin/diablo121016.cl @@ -0,0 +1,1274 @@ +/* + * DiabloMiner - OpenCL miner for BitCoin + * Copyright (C) 2010, 2011, 2012 Patrick McFarland + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more detail). + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifdef VECTORS4 + typedef uint4 z; +#elif defined(VECTORS2) + typedef uint2 z; +#else + typedef uint z; +#endif + +#ifdef BITALIGN +#pragma OPENCL EXTENSION cl_amd_media_ops : enable +#define Zrotr(a, b) amd_bitalign((z)a, (z)a, (z)(32 - b)) +#else +#define Zrotr(a, b) rotate((z)a, (z)b) +#endif + +#ifdef BFI_INT +#define ZCh(a, b, c) amd_bytealign(a, b, c) +#define ZMa(a, b, c) amd_bytealign((c ^ a), (b), (a)) +#else +#define ZCh(a, b, c) bitselect((z)c, (z)b, (z)a) +#define ZMa(a, b, c) bitselect((z)a, (z)b, (z)c ^ (z)a) +#endif + +#define ZR25(n) ((Zrotr((n), 25) ^ Zrotr((n), 14) ^ ((n) >> 3U))) +#define ZR15(n) ((Zrotr((n), 15) ^ Zrotr((n), 13) ^ ((n) >> 10U))) +#define ZR26(n) ((Zrotr((n), 26) ^ Zrotr((n), 21) ^ Zrotr((n), 7))) +#define ZR30(n) ((Zrotr((n), 30) ^ Zrotr((n), 19) ^ Zrotr((n), 10))) + +__kernel +__attribute__((vec_type_hint(z))) +__attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) +void search( +#ifndef GOFFSET + const z base, +#endif + const uint PreVal4_state0, const uint PreVal4_state0_k7, + const uint PreVal4_T1, + const uint W18, const uint W19, + const uint W16, const uint W17, + const uint W16_plus_K16, const uint W17_plus_K17, + const uint W31, const uint W32, + const uint d1, const uint b1, const uint c1, + const uint h1, const uint f1, const uint g1, + const uint c1_plus_k5, const uint b1_plus_k6, + const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + volatile __global uint * output) +{ + + z ZA[930]; + +#ifdef GOFFSET + const z Znonce = (uint)(get_global_id(0)); +#else + const z Znonce = base + (uint)(get_global_id(0)); +#endif + + ZA[15] = Znonce + PreVal4_state0; + + ZA[16] = (ZCh(ZA[15], b1, c1) + d1) + ZR26(ZA[15]); + ZA[26] = Znonce + PreVal4_T1; + + ZA[27] = ZMa(f1, g1, ZA[26]) + ZR30(ZA[26]); + ZA[17] = ZA[16] + h1; + + ZA[19] = (ZCh(ZA[17], ZA[15], b1) + c1_plus_k5) + ZR26(ZA[17]); + ZA[28] = ZA[27] + ZA[16]; + + ZA[548] = ZMa(ZA[26], f1, ZA[28]) + ZR30(ZA[28]); + ZA[20] = ZA[19] + g1; + + ZA[22] = (ZCh(ZA[20], ZA[17], ZA[15]) + b1_plus_k6) + ZR26(ZA[20]); + ZA[29] = ZA[548] + ZA[19]; + + ZA[549] = ZMa(ZA[28], ZA[26], ZA[29]) + ZR30(ZA[29]); + ZA[23] = ZA[22] + f1; + + ZA[24] = ZCh(ZA[23], ZA[20], ZA[17]) + ZR26(ZA[23]); + ZA[180] = Znonce + PreVal4_state0_k7; + ZA[30] = ZA[549] + ZA[22]; + + ZA[31] = ZMa(ZA[29], ZA[28], ZA[30]) + ZR30(ZA[30]); + ZA[181] = ZA[180] + ZA[24]; + + ZA[182] = ZA[181] + ZA[26]; + ZA[183] = ZA[181] + ZA[31]; + ZA[18] = ZA[17] + 0xd807aa98U; + + ZA[186] = (ZCh(ZA[182], ZA[23], ZA[20]) + ZA[18]) + ZR26(ZA[182]); + ZA[184] = ZMa(ZA[30], ZA[29], ZA[183]) + ZR30(ZA[183]); + + ZA[187] = ZA[186] + ZA[28]; + ZA[188] = ZA[186] + ZA[184]; + ZA[21] = ZA[20] + 0x12835b01U; + + ZA[191] = (ZCh(ZA[187], ZA[182], ZA[23]) + ZA[21]) + ZR26(ZA[187]); + ZA[189] = ZMa(ZA[183], ZA[30], ZA[188]) + ZR30(ZA[188]); + + ZA[192] = ZA[191] + ZA[29]; + ZA[193] = ZA[191] + ZA[189]; + ZA[25] = ZA[23] + 0x243185beU; + + ZA[196] = (ZCh(ZA[192], ZA[187], ZA[182]) + ZA[25]) + ZR26(ZA[192]); + ZA[194] = ZMa(ZA[188], ZA[183], ZA[193]) + ZR30(ZA[193]); + + ZA[197] = ZA[196] + ZA[30]; + ZA[198] = ZA[196] + ZA[194]; + ZA[185] = ZA[182] + 0x550c7dc3U; + + ZA[201] = (ZCh(ZA[197], ZA[192], ZA[187]) + ZA[185]) + ZR26(ZA[197]); + ZA[199] = ZMa(ZA[193], ZA[188], ZA[198]) + ZR30(ZA[198]); + + ZA[202] = ZA[201] + ZA[183]; + ZA[203] = ZA[201] + ZA[199]; + ZA[190] = ZA[187] + 0x72be5d74U; + + ZA[206] = (ZCh(ZA[202], ZA[197], ZA[192]) + ZA[190]) + ZR26(ZA[202]); + ZA[204] = ZMa(ZA[198], ZA[193], ZA[203]) + ZR30(ZA[203]); + + ZA[207] = ZA[206] + ZA[188]; + ZA[208] = ZA[206] + ZA[204]; + ZA[195] = ZA[192] + 0x80deb1feU; + + ZA[211] = (ZCh(ZA[207], ZA[202], ZA[197]) + ZA[195]) + ZR26(ZA[207]); + ZA[209] = ZMa(ZA[203], ZA[198], ZA[208]) + ZR30(ZA[208]); + + ZA[212] = ZA[193] + ZA[211]; + ZA[213] = ZA[211] + ZA[209]; + ZA[200] = ZA[197] + 0x9bdc06a7U; + + ZA[216] = (ZCh(ZA[212], ZA[207], ZA[202]) + ZA[200]) + ZR26(ZA[212]); + ZA[214] = ZMa(ZA[208], ZA[203], ZA[213]) + ZR30(ZA[213]); + + ZA[217] = ZA[198] + ZA[216]; + ZA[218] = ZA[216] + ZA[214]; + ZA[205] = ZA[202] + 0xc19bf3f4U; + + ZA[220] = (ZCh(ZA[217], ZA[212], ZA[207]) + ZA[205]) + ZR26(ZA[217]); + ZA[219] = ZMa(ZA[213], ZA[208], ZA[218]) + ZR30(ZA[218]); + + ZA[222] = ZA[203] + ZA[220]; + ZA[223] = ZA[220] + ZA[219]; + ZA[210] = ZA[207] + W16_plus_K16; + + ZA[226] = (ZCh(ZA[222], ZA[217], ZA[212]) + ZA[210]) + ZR26(ZA[222]); + ZA[225] = ZMa(ZA[218], ZA[213], ZA[223]) + ZR30(ZA[223]); + + ZA[0] = ZR25(Znonce) + W18; + ZA[228] = ZA[226] + ZA[225]; + ZA[227] = ZA[208] + ZA[226]; + ZA[215] = ZA[212] + W17_plus_K17; + + ZA[231] = (ZCh(ZA[227], ZA[222], ZA[217]) + ZA[215]) + ZR26(ZA[227]); + ZA[229] = ZMa(ZA[223], ZA[218], ZA[228]) + ZR30(ZA[228]); + ZA[1] = ZA[0] + 0x0fc19dc6U; + + ZA[232] = ZA[213] + ZA[231]; + ZA[233] = ZA[231] + ZA[229]; + ZA[221] = ZA[217] + ZA[1]; + ZA[32] = Znonce + W19; + + ZA[236] = (ZCh(ZA[232], ZA[227], ZA[222]) + ZA[221]) + ZR26(ZA[232]); + ZA[234] = ZMa(ZA[228], ZA[223], ZA[233]) + ZR30(ZA[233]); + ZA[33] = ZA[32] + 0x240ca1ccU; + + ZA[3] = ZR15(ZA[0]) + 0x80000000U; + ZA[238] = ZA[236] + ZA[234]; + ZA[237] = ZA[218] + ZA[236]; + ZA[224] = ZA[222] + ZA[33]; + + ZA[241] = (ZCh(ZA[237], ZA[232], ZA[227]) + ZA[224]) + ZR26(ZA[237]); + ZA[239] = ZMa(ZA[233], ZA[228], ZA[238]) + ZR30(ZA[238]); + ZA[4] = ZA[3] + 0x2de92c6fU; + + ZA[35] = ZR15(ZA[32]); + ZA[243] = ZA[241] + ZA[239]; + ZA[242] = ZA[223] + ZA[241]; + ZA[230] = ZA[227] + ZA[4]; + + ZA[246] = (ZCh(ZA[242], ZA[237], ZA[232]) + ZA[230]) + ZR26(ZA[242]); + ZA[244] = ZMa(ZA[238], ZA[233], ZA[243]) + ZR30(ZA[243]); + ZA[36] = ZA[35] + 0x4a7484aaU; + + ZA[7] = ZR15(ZA[3]) + 0x00000280U; + ZA[248] = ZA[246] + ZA[244]; + ZA[247] = ZA[228] + ZA[246]; + ZA[235] = ZA[232] + ZA[36]; + + ZA[251] = (ZCh(ZA[247], ZA[242], ZA[237]) + ZA[235]) + ZR26(ZA[247]); + ZA[249] = ZMa(ZA[243], ZA[238], ZA[248]) + ZR30(ZA[248]); + ZA[8] = ZA[7] + 0x5cb0a9dcU; + + ZA[38] = ZR15(ZA[35]) + W16; + ZA[253] = ZA[251] + ZA[249]; + ZA[252] = ZA[233] + ZA[251]; + ZA[240] = ZA[237] + ZA[8]; + + ZA[256] = (ZCh(ZA[252], ZA[247], ZA[242]) + ZA[240]) + ZR26(ZA[252]); + ZA[254] = ZMa(ZA[248], ZA[243], ZA[253]) + ZR30(ZA[253]); + ZA[40] = ZA[38] + 0x76f988daU; + + ZA[10] = ZR15(ZA[7]) + W17; + ZA[258] = ZA[256] + ZA[254]; + ZA[257] = ZA[238] + ZA[256]; + ZA[245] = ZA[242] + ZA[40]; + + ZA[261] = (ZCh(ZA[257], ZA[252], ZA[247]) + ZA[245]) + ZR26(ZA[257]); + ZA[259] = ZMa(ZA[253], ZA[248], ZA[258]) + ZR30(ZA[258]); + ZA[13] = ZA[10] + 0x983e5152U; + + ZA[43] = ZR15(ZA[38]) + ZA[0]; + ZA[263] = ZA[261] + ZA[259]; + ZA[262] = ZA[243] + ZA[261]; + ZA[250] = ZA[247] + ZA[13]; + + ZA[266] = (ZCh(ZA[262], ZA[257], ZA[252]) + ZA[250]) + ZR26(ZA[262]); + ZA[264] = ZMa(ZA[258], ZA[253], ZA[263]) + ZR30(ZA[263]); + ZA[11] = ZR15(ZA[10]); + ZA[45] = ZA[43] + 0xa831c66dU; + + ZA[52] = ZA[11] + ZA[32]; + ZA[267] = ZA[248] + ZA[266]; + ZA[255] = ZA[252] + ZA[45]; + ZA[268] = ZA[266] + ZA[264]; + + ZA[271] = (ZCh(ZA[267], ZA[262], ZA[257]) + ZA[255]) + ZR26(ZA[267]); + ZA[269] = ZMa(ZA[263], ZA[258], ZA[268]) + ZR30(ZA[268]); + ZA[54] = ZA[52] + 0xb00327c8U; + + ZA[48] = ZR15(ZA[43]) + ZA[3]; + ZA[273] = ZA[271] + ZA[269]; + ZA[272] = ZA[253] + ZA[271]; + ZA[260] = ZA[257] + ZA[54]; + + ZA[276] = (ZCh(ZA[272], ZA[267], ZA[262]) + ZA[260]) + ZR26(ZA[272]); + ZA[274] = ZMa(ZA[268], ZA[263], ZA[273]) + ZR30(ZA[273]); + ZA[49] = ZA[48] + 0xbf597fc7U; + + ZA[61] = ZR15(ZA[52]) + ZA[35]; + ZA[278] = ZA[276] + ZA[274]; + ZA[277] = ZA[258] + ZA[276]; + ZA[265] = ZA[262] + ZA[49]; + + ZA[281] = (ZCh(ZA[277], ZA[272], ZA[267]) + ZA[265]) + ZR26(ZA[277]); + ZA[279] = ZMa(ZA[273], ZA[268], ZA[278]) + ZR30(ZA[278]); + ZA[62] = ZA[61] + 0xc6e00bf3U; + + ZA[53] = ZR15(ZA[48]) + ZA[7]; + ZA[283] = ZA[281] + ZA[279]; + ZA[282] = ZA[263] + ZA[281]; + ZA[270] = ZA[267] + ZA[62]; + + ZA[286] = (ZCh(ZA[282], ZA[277], ZA[272]) + ZA[270]) + ZR26(ZA[282]); + ZA[284] = ZMa(ZA[278], ZA[273], ZA[283]) + ZR30(ZA[283]); + ZA[39] = ZA[38] + 0x00A00055U; + ZA[55] = ZA[53] + 0xd5a79147U; + + ZA[66] = ZR15(ZA[61]) + ZA[39]; + ZA[288] = ZA[286] + ZA[284]; + ZA[287] = ZA[268] + ZA[286]; + ZA[275] = ZA[272] + ZA[55]; + + ZA[291] = (ZCh(ZA[287], ZA[282], ZA[277]) + ZA[275]) + ZR26(ZA[287]); + ZA[289] = ZMa(ZA[283], ZA[278], ZA[288]) + ZR30(ZA[288]); + ZA[12] = ZA[10] + W31; + ZA[68] = ZA[66] + 0x06ca6351U; + + ZA[67] = ZR15(ZA[53]) + ZA[12]; + ZA[293] = ZA[291] + ZA[289]; + ZA[292] = ZA[273] + ZA[291]; + ZA[280] = ZA[277] + ZA[68]; + + ZA[296] = (ZCh(ZA[292], ZA[287], ZA[282]) + ZA[280]) + ZR26(ZA[292]); + ZA[294] = ZMa(ZA[288], ZA[283], ZA[293]) + ZR30(ZA[293]); + ZA[2] = ZR25(ZA[0]); + ZA[69] = ZA[67] + 0x14292967U; + ZA[44] = ZA[43] + W32; + + ZA[75] = ZR15(ZA[66]) + ZA[44]; + ZA[298] = ZA[296] + ZA[294]; + ZA[297] = ZA[278] + ZA[296]; + ZA[285] = ZA[282] + ZA[69]; + ZA[5] = ZA[2] + W17; + + ZA[301] = (ZCh(ZA[297], ZA[292], ZA[287]) + ZA[285]) + ZR26(ZA[297]); + ZA[299] = ZMa(ZA[293], ZA[288], ZA[298]) + ZR30(ZA[298]); + ZA[56] = ZA[52] + ZA[5]; + ZA[76] = ZA[75] + 0x27b70a85U; + + ZA[34] = ZR25(ZA[32]) + ZA[0]; + ZA[70] = ZR15(ZA[67]) + ZA[56]; + ZA[302] = ZA[283] + ZA[301]; + ZA[303] = ZA[301] + ZA[299]; + ZA[290] = ZA[287] + ZA[76]; + + ZA[306] = (ZCh(ZA[302], ZA[297], ZA[292]) + ZA[290]) + ZR26(ZA[302]); + ZA[304] = ZMa(ZA[298], ZA[293], ZA[303]) + ZR30(ZA[303]); + ZA[6] = ZR25(ZA[3]); + ZA[77] = ZA[70] + 0x2e1b2138U; + ZA[50] = ZA[34] + ZA[48]; + + ZA[78] = ZR15(ZA[75]) + ZA[50]; + ZA[308] = ZA[306] + ZA[304]; + ZA[307] = ZA[288] + ZA[306]; + ZA[295] = ZA[292] + ZA[77]; + ZA[41] = ZA[32] + ZA[6]; + + ZA[311] = (ZCh(ZA[307], ZA[302], ZA[297]) + ZA[295]) + ZR26(ZA[307]); + ZA[309] = ZMa(ZA[303], ZA[298], ZA[308]) + ZR30(ZA[308]); + ZA[63] = ZA[41] + ZA[61]; + ZA[85] = ZA[78] + 0x4d2c6dfcU; + + ZA[37] = ZR25(ZA[35]) + ZA[3]; + ZA[79] = ZR15(ZA[70]) + ZA[63]; + ZA[312] = ZA[293] + ZA[311]; + ZA[313] = ZA[311] + ZA[309]; + ZA[300] = ZA[297] + ZA[85]; + + ZA[316] = (ZCh(ZA[312], ZA[307], ZA[302]) + ZA[300]) + ZR26(ZA[312]); + ZA[314] = ZMa(ZA[308], ZA[303], ZA[313]) + ZR30(ZA[313]); + ZA[9] = ZR25(ZA[7]); + ZA[86] = ZA[79] + 0x53380d13U; + ZA[57] = ZA[37] + ZA[53]; + + ZA[87] = ZR15(ZA[78]) + ZA[57]; + ZA[318] = ZA[316] + ZA[314]; + ZA[317] = ZA[298] + ZA[316]; + ZA[305] = ZA[302] + ZA[86]; + ZA[46] = ZA[35] + ZA[9]; + + ZA[321] = (ZCh(ZA[317], ZA[312], ZA[307]) + ZA[305]) + ZR26(ZA[317]); + ZA[319] = ZMa(ZA[313], ZA[308], ZA[318]) + ZR30(ZA[318]); + ZA[71] = ZA[46] + ZA[66]; + ZA[92] = ZA[87] + 0x650a7354U; + + ZA[42] = ZR25(ZA[38]) + ZA[7]; + ZA[88] = ZR15(ZA[79]) + ZA[71]; + ZA[322] = ZA[303] + ZA[321]; + ZA[323] = ZA[321] + ZA[319]; + ZA[310] = ZA[307] + ZA[92]; + + ZA[326] = (ZCh(ZA[322], ZA[317], ZA[312]) + ZA[310]) + ZR26(ZA[322]); + ZA[324] = ZMa(ZA[318], ZA[313], ZA[323]) + ZR30(ZA[323]); + ZA[14] = ZR25(ZA[10]); + ZA[93] = ZA[88] + 0x766a0abbU; + ZA[72] = ZA[42] + ZA[67]; + + ZA[94] = ZR15(ZA[87]) + ZA[72]; + ZA[328] = ZA[326] + ZA[324]; + ZA[327] = ZA[308] + ZA[326]; + ZA[315] = ZA[312] + ZA[93]; + ZA[51] = ZA[38] + ZA[14]; + + ZA[331] = (ZCh(ZA[327], ZA[322], ZA[317]) + ZA[315]) + ZR26(ZA[327]); + ZA[329] = ZMa(ZA[323], ZA[318], ZA[328]) + ZR30(ZA[328]); + ZA[80] = ZA[51] + ZA[75]; + ZA[100] = ZA[94] + 0x81c2c92eU; + + ZA[47] = ZR25(ZA[43]) + ZA[10]; + ZA[95] = ZR15(ZA[88]) + ZA[80]; + ZA[332] = ZA[313] + ZA[331]; + ZA[333] = ZA[331] + ZA[329]; + ZA[320] = ZA[317] + ZA[100]; + + ZA[336] = (ZCh(ZA[332], ZA[327], ZA[322]) + ZA[320]) + ZR26(ZA[332]); + ZA[334] = ZMa(ZA[328], ZA[323], ZA[333]) + ZR30(ZA[333]); + ZA[81] = ZA[47] + ZA[70]; + ZA[101] = ZA[95] + 0x92722c85U; + + ZA[58] = ZR25(ZA[52]) + ZA[43]; + ZA[102] = ZR15(ZA[94]) + ZA[81]; + ZA[337] = ZA[318] + ZA[336]; + ZA[338] = ZA[336] + ZA[334]; + ZA[325] = ZA[322] + ZA[101]; + + ZA[341] = (ZCh(ZA[337], ZA[332], ZA[327]) + ZA[325]) + ZR26(ZA[337]); + ZA[339] = ZMa(ZA[333], ZA[328], ZA[338]) + ZR30(ZA[338]); + ZA[89] = ZA[58] + ZA[78]; + ZA[108] = ZA[102] + 0xa2bfe8a1U; + + ZA[59] = ZR25(ZA[48]) + ZA[52]; + ZA[103] = ZR15(ZA[95]) + ZA[89]; + ZA[342] = ZA[323] + ZA[341]; + ZA[343] = ZA[341] + ZA[339]; + ZA[330] = ZA[327] + ZA[108]; + + ZA[346] = (ZCh(ZA[342], ZA[337], ZA[332]) + ZA[330]) + ZR26(ZA[342]); + ZA[344] = ZMa(ZA[338], ZA[333], ZA[343]) + ZR30(ZA[343]); + ZA[90] = ZA[59] + ZA[79]; + ZA[109] = ZA[103] + 0xa81a664bU; + + ZA[64] = ZR25(ZA[61]) + ZA[48]; + ZA[110] = ZR15(ZA[102]) + ZA[90]; + ZA[347] = ZA[328] + ZA[346]; + ZA[348] = ZA[346] + ZA[344]; + ZA[335] = ZA[332] + ZA[109]; + + ZA[351] = (ZCh(ZA[347], ZA[342], ZA[337]) + ZA[335]) + ZR26(ZA[347]); + ZA[349] = ZMa(ZA[343], ZA[338], ZA[348]) + ZR30(ZA[348]); + ZA[60] = ZR25(ZA[53]); + ZA[116] = ZA[110] + 0xc24b8b70U; + ZA[96] = ZA[87] + ZA[64]; + + ZA[111] = ZR15(ZA[103]) + ZA[96]; + ZA[353] = ZA[351] + ZA[349]; + ZA[352] = ZA[333] + ZA[351]; + ZA[340] = ZA[337] + ZA[116]; + ZA[65] = ZA[60] + ZA[61]; + + ZA[356] = (ZCh(ZA[352], ZA[347], ZA[342]) + ZA[340]) + ZR26(ZA[352]); + ZA[354] = ZMa(ZA[348], ZA[343], ZA[353]) + ZR30(ZA[353]); + ZA[97] = ZA[88] + ZA[65]; + ZA[117] = ZA[111] + 0xc76c51a3U; + + ZA[73] = ZR25(ZA[66]) + ZA[53]; + ZA[118] = ZR15(ZA[110]) + ZA[97]; + ZA[357] = ZA[338] + ZA[356]; + ZA[358] = ZA[356] + ZA[354]; + ZA[345] = ZA[342] + ZA[117]; + + ZA[361] = (ZCh(ZA[357], ZA[352], ZA[347]) + ZA[345]) + ZR26(ZA[357]); + ZA[359] = ZMa(ZA[353], ZA[348], ZA[358]) + ZR30(ZA[358]); + ZA[104] = ZA[73] + ZA[94]; + ZA[124] = ZA[118] + 0xd192e819U; + + ZA[74] = ZR25(ZA[67]) + ZA[66]; + ZA[119] = ZR15(ZA[111]) + ZA[104]; + ZA[362] = ZA[343] + ZA[361]; + ZA[363] = ZA[361] + ZA[359]; + ZA[350] = ZA[347] + ZA[124]; + + ZA[366] = (ZCh(ZA[362], ZA[357], ZA[352]) + ZA[350]) + ZR26(ZA[362]); + ZA[364] = ZMa(ZA[358], ZA[353], ZA[363]) + ZR30(ZA[363]); + ZA[105] = ZA[74] + ZA[95]; + ZA[125] = ZA[119] + 0xd6990624U; + + ZA[82] = ZR25(ZA[75]) + ZA[67]; + ZA[126] = ZR15(ZA[118]) + ZA[105]; + ZA[367] = ZA[348] + ZA[366]; + ZA[368] = ZA[366] + ZA[364]; + ZA[355] = ZA[352] + ZA[125]; + + ZA[371] = (ZCh(ZA[367], ZA[362], ZA[357]) + ZA[355]) + ZR26(ZA[367]); + ZA[369] = ZMa(ZA[363], ZA[358], ZA[368]) + ZR30(ZA[368]); + ZA[112] = ZA[102] + ZA[82]; + ZA[132] = ZA[126] + 0xf40e3585U; + + ZA[83] = ZR25(ZA[70]) + ZA[75]; + ZA[127] = ZR15(ZA[119]) + ZA[112]; + ZA[372] = ZA[353] + ZA[371]; + ZA[373] = ZA[371] + ZA[369]; + ZA[360] = ZA[357] + ZA[132]; + + ZA[376] = (ZCh(ZA[372], ZA[367], ZA[362]) + ZA[360]) + ZR26(ZA[372]); + ZA[374] = ZMa(ZA[368], ZA[363], ZA[373]) + ZR30(ZA[373]); + ZA[113] = ZA[103] + ZA[83]; + ZA[133] = ZA[127] + 0x106aa070U; + + ZA[84] = ZR25(ZA[78]) + ZA[70]; + ZA[134] = ZR15(ZA[126]) + ZA[113]; + ZA[377] = ZA[358] + ZA[376]; + ZA[378] = ZA[376] + ZA[374]; + ZA[365] = ZA[362] + ZA[133]; + + ZA[381] = (ZCh(ZA[377], ZA[372], ZA[367]) + ZA[365]) + ZR26(ZA[377]); + ZA[379] = ZMa(ZA[373], ZA[368], ZA[378]) + ZR30(ZA[378]); + ZA[120] = ZA[110] + ZA[84]; + ZA[140] = ZA[134] + 0x19a4c116U; + + ZA[91] = ZR25(ZA[79]) + ZA[78]; + ZA[135] = ZR15(ZA[127]) + ZA[120]; + ZA[382] = ZA[363] + ZA[381]; + ZA[383] = ZA[381] + ZA[379]; + ZA[370] = ZA[367] + ZA[140]; + + ZA[386] = (ZCh(ZA[382], ZA[377], ZA[372]) + ZA[370]) + ZR26(ZA[382]); + ZA[384] = ZMa(ZA[378], ZA[373], ZA[383]) + ZR30(ZA[383]); + ZA[121] = ZA[111] + ZA[91]; + ZA[141] = ZA[135] + 0x1e376c08U; + + ZA[98] = ZR25(ZA[87]) + ZA[79]; + ZA[142] = ZR15(ZA[134]) + ZA[121]; + ZA[387] = ZA[368] + ZA[386]; + ZA[388] = ZA[386] + ZA[384]; + ZA[375] = ZA[372] + ZA[141]; + + ZA[391] = (ZCh(ZA[387], ZA[382], ZA[377]) + ZA[375]) + ZR26(ZA[387]); + ZA[389] = ZMa(ZA[383], ZA[378], ZA[388]) + ZR30(ZA[388]); + ZA[128] = ZA[118] + ZA[98]; + ZA[147] = ZA[142] + 0x2748774cU; + + ZA[99] = ZR25(ZA[88]) + ZA[87]; + ZA[143] = ZR15(ZA[135]) + ZA[128]; + ZA[392] = ZA[373] + ZA[391]; + ZA[393] = ZA[391] + ZA[389]; + ZA[380] = ZA[377] + ZA[147]; + + ZA[396] = (ZCh(ZA[392], ZA[387], ZA[382]) + ZA[380]) + ZR26(ZA[392]); + ZA[394] = ZMa(ZA[388], ZA[383], ZA[393]) + ZR30(ZA[393]); + ZA[129] = ZA[119] + ZA[99]; + ZA[148] = ZA[143] + 0x34b0bcb5U; + + ZA[106] = ZR25(ZA[94]) + ZA[88]; + ZA[149] = ZR15(ZA[142]) + ZA[129]; + ZA[397] = ZA[378] + ZA[396]; + ZA[398] = ZA[396] + ZA[394]; + ZA[385] = ZA[382] + ZA[148]; + + ZA[401] = (ZCh(ZA[397], ZA[392], ZA[387]) + ZA[385]) + ZR26(ZA[397]); + ZA[399] = ZMa(ZA[393], ZA[388], ZA[398]) + ZR30(ZA[398]); + ZA[136] = ZA[126] + ZA[106]; + ZA[153] = ZA[149] + 0x391c0cb3U; + + ZA[107] = ZR25(ZA[95]) + ZA[94]; + ZA[150] = ZR15(ZA[143]) + ZA[136]; + ZA[402] = ZA[383] + ZA[401]; + ZA[403] = ZA[401] + ZA[399]; + ZA[390] = ZA[387] + ZA[153]; + + ZA[406] = (ZCh(ZA[402], ZA[397], ZA[392]) + ZA[390]) + ZR26(ZA[402]); + ZA[404] = ZMa(ZA[398], ZA[393], ZA[403]) + ZR30(ZA[403]); + ZA[137] = ZA[127] + ZA[107]; + ZA[154] = ZA[150] + 0x4ed8aa4aU; + + ZA[114] = ZR25(ZA[102]) + ZA[95]; + ZA[155] = ZR15(ZA[149]) + ZA[137]; + ZA[407] = ZA[388] + ZA[406]; + ZA[408] = ZA[406] + ZA[404]; + ZA[395] = ZA[392] + ZA[154]; + + ZA[411] = (ZCh(ZA[407], ZA[402], ZA[397]) + ZA[395]) + ZR26(ZA[407]); + ZA[409] = ZMa(ZA[403], ZA[398], ZA[408]) + ZR30(ZA[408]); + ZA[144] = ZA[134] + ZA[114]; + ZA[159] = ZA[155] + 0x5b9cca4fU; + + ZA[115] = ZR25(ZA[103]) + ZA[102]; + ZA[156] = ZR15(ZA[150]) + ZA[144]; + ZA[412] = ZA[393] + ZA[411]; + ZA[413] = ZA[411] + ZA[409]; + ZA[400] = ZA[397] + ZA[159]; + + ZA[416] = (ZCh(ZA[412], ZA[407], ZA[402]) + ZA[400]) + ZR26(ZA[412]); + ZA[414] = ZMa(ZA[408], ZA[403], ZA[413]) + ZR30(ZA[413]); + ZA[145] = ZA[135] + ZA[115]; + ZA[160] = ZA[156] + 0x682e6ff3U; + + ZA[122] = ZR25(ZA[110]) + ZA[103]; + ZA[161] = ZR15(ZA[155]) + ZA[145]; + ZA[417] = ZA[398] + ZA[416]; + ZA[418] = ZA[416] + ZA[414]; + ZA[405] = ZA[402] + ZA[160]; + + ZA[421] = (ZCh(ZA[417], ZA[412], ZA[407]) + ZA[405]) + ZR26(ZA[417]); + ZA[419] = ZMa(ZA[413], ZA[408], ZA[418]) + ZR30(ZA[418]); + ZA[151] = ZA[142] + ZA[122]; + ZA[165] = ZA[161] + 0x748f82eeU; + + ZA[123] = ZR25(ZA[111]) + ZA[110]; + ZA[162] = ZR15(ZA[156]) + ZA[151]; + ZA[422] = ZA[403] + ZA[421]; + ZA[423] = ZA[421] + ZA[419]; + ZA[410] = ZA[407] + ZA[165]; + + ZA[426] = (ZCh(ZA[422], ZA[417], ZA[412]) + ZA[410]) + ZR26(ZA[422]); + ZA[424] = ZMa(ZA[418], ZA[413], ZA[423]) + ZR30(ZA[423]); + ZA[152] = ZA[143] + ZA[123]; + ZA[166] = ZA[162] + 0x78a5636fU; + + ZA[130] = ZR25(ZA[118]) + ZA[111]; + ZA[167] = ZR15(ZA[161]) + ZA[152]; + ZA[427] = ZA[408] + ZA[426]; + ZA[428] = ZA[426] + ZA[424]; + ZA[415] = ZA[412] + ZA[166]; + + ZA[431] = (ZCh(ZA[427], ZA[422], ZA[417]) + ZA[415]) + ZR26(ZA[427]); + ZA[429] = ZMa(ZA[423], ZA[418], ZA[428]) + ZR30(ZA[428]); + ZA[157] = ZA[149] + ZA[130]; + ZA[170] = ZA[167] + 0x84c87814U; + + ZA[131] = ZR25(ZA[119]) + ZA[118]; + ZA[168] = ZR15(ZA[162]) + ZA[157]; + ZA[432] = ZA[413] + ZA[431]; + ZA[433] = ZA[431] + ZA[429]; + ZA[420] = ZA[417] + ZA[170]; + + ZA[436] = (ZCh(ZA[432], ZA[427], ZA[422]) + ZA[420]) + ZR26(ZA[432]); + ZA[434] = ZMa(ZA[428], ZA[423], ZA[433]) + ZR30(ZA[433]); + ZA[158] = ZA[150] + ZA[131]; + ZA[171] = ZA[168] + 0x8cc70208U; + + ZA[138] = ZR25(ZA[126]) + ZA[119]; + ZA[172] = ZR15(ZA[167]) + ZA[158]; + ZA[437] = ZA[418] + ZA[436]; + ZA[438] = ZA[436] + ZA[434]; + ZA[425] = ZA[422] + ZA[171]; + + ZA[441] = (ZCh(ZA[437], ZA[432], ZA[427]) + ZA[425]) + ZR26(ZA[437]); + ZA[439] = ZMa(ZA[433], ZA[428], ZA[438]) + ZR30(ZA[438]); + ZA[163] = ZA[155] + ZA[138]; + ZA[174] = ZA[172] + 0x90befffaU; + + ZA[139] = ZR25(ZA[127]) + ZA[126]; + ZA[173] = ZR15(ZA[168]) + ZA[163]; + ZA[442] = ZA[423] + ZA[441]; + ZA[443] = ZA[441] + ZA[439]; + ZA[430] = ZA[427] + ZA[174]; + + ZA[445] = (ZCh(ZA[442], ZA[437], ZA[432]) + ZA[430]) + ZR26(ZA[442]); + ZA[444] = ZMa(ZA[438], ZA[433], ZA[443]) + ZR30(ZA[443]); + ZA[164] = ZA[156] + ZA[139]; + ZA[175] = ZA[173] + 0xa4506cebU; + + ZA[146] = ZR25(ZA[134]) + ZA[127]; + ZA[176] = ZR15(ZA[172]) + ZA[164]; + ZA[446] = ZA[428] + ZA[445]; + ZA[447] = ZA[445] + ZA[444]; + ZA[435] = ZA[432] + ZA[175]; + + ZA[449] = (ZCh(ZA[446], ZA[442], ZA[437]) + ZA[435]) + ZR26(ZA[446]); + ZA[448] = ZMa(ZA[443], ZA[438], ZA[447]) + ZR30(ZA[447]); + ZA[169] = ZA[161] + ZA[146]; + ZA[178] = ZA[176] + 0xbef9a3f7U; + + ZA[177] = ZR15(ZA[173]) + ZA[169]; + ZA[451] = ZA[449] + ZA[448]; + ZA[450] = ZA[433] + ZA[449]; + ZA[440] = ZA[437] + ZA[178]; + + ZA[453] = (ZCh(ZA[450], ZA[446], ZA[442]) + ZA[440]) + ZR26(ZA[450]); + ZA[452] = ZMa(ZA[447], ZA[443], ZA[451]) + ZR30(ZA[451]); + ZA[179] = ZA[177] + 0xc67178f2U; + + ZA[454] = ZA[438] + ZA[453]; + ZA[494] = ZA[442] + ZA[179]; + ZA[455] = ZA[453] + ZA[452]; + + ZA[457] = (ZCh(ZA[454], ZA[450], ZA[446]) + ZA[494]) + ZR26(ZA[454]); + ZA[456] = ZMa(ZA[451], ZA[447], ZA[455]) + ZR30(ZA[455]); + + ZA[459] = ZA[457] + ZA[456]; + + ZA[461] = ZA[455] + state1; + ZA[460] = ZA[459] + state0; + + ZA[495] = ZA[460] + 0x98c7e2a2U; + ZA[469] = ZA[461] + 0x90bb1e3cU; + + ZA[498] = (ZCh(ZA[495], 0x510e527fU, 0x9b05688cU) + ZA[469]) + ZR26(ZA[495]); + ZA[462] = ZA[451] + state2; + + ZA[496] = ZA[460] + 0xfc08884dU; + ZA[506] = ZA[498] + 0x3c6ef372U; + ZA[470] = ZA[462] + 0x50c6645bU; + + ZA[507] = (ZCh(ZA[506], ZA[495], 0x510e527fU) + ZA[470]) + ZR26(ZA[506]); + ZA[500] = ZMa(0x6a09e667U, 0xbb67ae85U, ZA[496]) + ZR30(ZA[496]); + ZA[463] = ZA[447] + state3; + + ZA[458] = ZA[443] + ZA[457]; + ZA[499] = ZA[498] + ZA[500]; + ZA[508] = ZA[507] + 0xbb67ae85U; + ZA[473] = ZA[463] + 0x3ac42e24U; + + ZA[510] = (ZCh(ZA[508], ZA[506], ZA[495]) + ZA[473]) + ZR26(ZA[508]); + ZA[928] = ZMa(ZA[496], 0x6a09e667U, ZA[499]) + ZR30(ZA[499]); + ZA[464] = ZA[458] + state4; + + ZA[476] = ZA[464] + ZA[460] + 0xd21ea4fdU; + ZA[511] = ZA[510] + 0x6a09e667U; + ZA[509] = ZA[928] + ZA[507]; + ZA[465] = ZA[454] + state5; + + ZA[514] = (ZCh(ZA[511], ZA[508], ZA[506]) + ZA[476]) + ZR26(ZA[511]); + ZA[512] = ZMa(ZA[499], ZA[496], ZA[509]) + ZR30(ZA[509]); + ZA[478] = ZA[465] + 0x59f111f1U; + + ZA[519] = ZA[506] + ZA[478]; + ZA[516] = ZA[496] + ZA[514]; + ZA[513] = ZA[510] + ZA[512]; + ZA[466] = ZA[450] + state6; + + ZA[520] = (ZCh(ZA[516], ZA[511], ZA[508]) + ZA[519]) + ZR26(ZA[516]); + ZA[515] = ZMa(ZA[509], ZA[499], ZA[513]) + ZR30(ZA[513]); + ZA[480] = ZA[466] + 0x923f82a4U; + + ZA[524] = ZA[508] + ZA[480]; + ZA[521] = ZA[499] + ZA[520]; + ZA[517] = ZA[514] + ZA[515]; + ZA[467] = ZA[446] + state7; + + ZA[525] = (ZCh(ZA[521], ZA[516], ZA[511]) + ZA[524]) + ZR26(ZA[521]); + ZA[522] = ZMa(ZA[513], ZA[509], ZA[517]) + ZR30(ZA[517]); + ZA[484] = ZA[467] + 0xab1c5ed5U; + + ZA[529] = ZA[511] + ZA[484]; + ZA[526] = ZA[509] + ZA[525]; + ZA[523] = ZA[520] + ZA[522]; + + ZA[530] = (ZCh(ZA[526], ZA[521], ZA[516]) + ZA[529]) + ZR26(ZA[526]); + ZA[550] = ZMa(ZA[517], ZA[513], ZA[523]) + ZR30(ZA[523]); + + ZA[531] = ZA[513] + ZA[530]; + ZA[533] = ZA[516] + 0x5807aa98U; + ZA[527] = ZA[550] + ZA[525]; + + ZA[534] = (ZCh(ZA[531], ZA[526], ZA[521]) + ZA[533]) + ZR26(ZA[531]); + ZA[551] = ZMa(ZA[523], ZA[517], ZA[527]) + ZR30(ZA[527]); + + ZA[535] = ZA[517] + ZA[534]; + ZA[538] = ZA[521] + 0x12835b01U; + ZA[532] = ZA[551] + ZA[530]; + + ZA[539] = (ZCh(ZA[535], ZA[531], ZA[526]) + ZA[538]) + ZR26(ZA[535]); + ZA[552] = ZMa(ZA[527], ZA[523], ZA[532]) + ZR30(ZA[532]); + + ZA[540] = ZA[523] + ZA[539]; + ZA[542] = ZA[526] + 0x243185beU; + ZA[536] = ZA[552] + ZA[534]; + + ZA[543] = (ZCh(ZA[540], ZA[535], ZA[531]) + ZA[542]) + ZR26(ZA[540]); + ZA[553] = ZMa(ZA[532], ZA[527], ZA[536]) + ZR30(ZA[536]); + + ZA[544] = ZA[527] + ZA[543]; + ZA[555] = ZA[531] + 0x550c7dc3U; + ZA[541] = ZA[553] + ZA[539]; + + ZA[558] = (ZCh(ZA[544], ZA[540], ZA[535]) + ZA[555]) + ZR26(ZA[544]); + ZA[547] = ZMa(ZA[536], ZA[532], ZA[541]) + ZR30(ZA[541]); + + ZA[559] = ZA[532] + ZA[558]; + ZA[556] = ZA[535] + 0x72be5d74U; + ZA[545] = ZA[547] + ZA[543]; + + ZA[562] = (ZCh(ZA[559], ZA[544], ZA[540]) + ZA[556]) + ZR26(ZA[559]); + ZA[561] = ZMa(ZA[541], ZA[536], ZA[545]) + ZR30(ZA[545]); + + ZA[563] = ZA[536] + ZA[562]; + ZA[560] = ZA[561] + ZA[558]; + ZA[557] = ZA[540] + 0x80deb1feU; + + ZA[568] = (ZCh(ZA[563], ZA[559], ZA[544]) + ZA[557]) + ZR26(ZA[563]); + ZA[564] = ZMa(ZA[545], ZA[541], ZA[560]) + ZR30(ZA[560]); + + ZA[569] = ZA[541] + ZA[568]; + ZA[572] = ZA[544] + 0x9bdc06a7U; + ZA[565] = ZA[562] + ZA[564]; + + ZA[574] = (ZCh(ZA[569], ZA[563], ZA[559]) + ZA[572]) + ZR26(ZA[569]); + ZA[570] = ZMa(ZA[560], ZA[545], ZA[565]) + ZR30(ZA[565]); + ZA[468] = ZR25(ZA[461]); + + ZA[497] = ZA[468] + ZA[460]; + ZA[575] = ZA[545] + ZA[574]; + ZA[571] = ZA[568] + ZA[570]; + ZA[573] = ZA[559] + 0xc19bf274U; + + ZA[578] = (ZCh(ZA[575], ZA[569], ZA[563]) + ZA[573]) + ZR26(ZA[575]); + ZA[576] = ZMa(ZA[565], ZA[560], ZA[571]) + ZR30(ZA[571]); + ZA[929] = ZR25(ZA[462]); + ZA[503] = ZA[497] + 0xe49b69c1U; + + ZA[471] = ZA[929] + ZA[461] + 0x00a00000U; + ZA[582] = ZA[563] + ZA[503]; + ZA[579] = ZA[560] + ZA[578]; + ZA[577] = ZA[574] + ZA[576]; + + ZA[583] = (ZCh(ZA[579], ZA[575], ZA[569]) + ZA[582]) + ZR26(ZA[579]); + ZA[580] = ZMa(ZA[571], ZA[565], ZA[577]) + ZR30(ZA[577]); + ZA[488] = ZA[471] + 0xefbe4786U; + + ZA[472] = ZR25(ZA[463]) + ZA[462]; + ZA[587] = ZA[569] + ZA[488]; + ZA[584] = ZA[565] + ZA[583]; + ZA[581] = ZA[578] + ZA[580]; + + ZA[588] = (ZCh(ZA[584], ZA[579], ZA[575]) + ZA[587]) + ZR26(ZA[584]); + ZA[586] = ZMa(ZA[577], ZA[571], ZA[581]) + ZR30(ZA[581]); + ZA[501] = ZR15(ZA[497]) + ZA[472]; + ZA[475] = ZR15(ZA[471]); + ZA[926] = ZA[575] + 0x0fc19dc6U; + + ZA[474] = ZA[475] + ZA[463] + ZR25(ZA[464]); + ZA[927] = ZA[926] + ZA[501]; + ZA[589] = ZA[571] + ZA[588]; + ZA[585] = ZA[583] + ZA[586]; + + ZA[592] = (ZCh(ZA[589], ZA[584], ZA[579]) + ZA[927]) + ZR26(ZA[589]); + ZA[590] = ZMa(ZA[581], ZA[577], ZA[585]) + ZR30(ZA[585]); + ZA[477] = ZR25(ZA[465]) + ZA[464]; + ZA[489] = ZA[474] + 0x240ca1ccU; + + ZA[518] = ZR15(ZA[501]) + ZA[477]; + ZA[479] = ZR25(ZA[466]); + ZA[596] = ZA[579] + ZA[489]; + ZA[593] = ZA[577] + ZA[592]; + ZA[591] = ZA[588] + ZA[590]; + + ZA[597] = (ZCh(ZA[593], ZA[589], ZA[584]) + ZA[596]) + ZR26(ZA[593]); + ZA[594] = ZMa(ZA[585], ZA[581], ZA[591]) + ZR30(ZA[591]); + ZA[481] = ZA[479] + ZA[465]; + ZA[601] = ZA[518] + 0x2de92c6fU; + + ZA[482] = ZR15(ZA[474]) + ZA[481]; + ZA[602] = ZA[584] + ZA[601]; + ZA[598] = ZA[581] + ZA[597]; + ZA[595] = ZA[592] + ZA[594]; + + ZA[632] = (ZCh(ZA[598], ZA[593], ZA[589]) + ZA[602]) + ZR26(ZA[598]); + ZA[599] = ZMa(ZA[591], ZA[585], ZA[595]) + ZR30(ZA[595]); + ZA[483] = ZA[466] + 0x00000100U + ZR25(ZA[467]); + ZA[490] = ZA[482] + 0x4a7484aaU; + + ZA[528] = ZR15(ZA[518]) + ZA[483]; + ZA[736] = ZA[585] + ZA[632]; + ZA[605] = ZA[589] + ZA[490]; + ZA[600] = ZA[597] + ZA[599]; + ZA[485] = ZA[467] + 0x11002000U; + + ZA[738] = (ZCh(ZA[736], ZA[598], ZA[593]) + ZA[605]) + ZR26(ZA[736]); + ZA[744] = ZMa(ZA[595], ZA[591], ZA[600]) + ZR30(ZA[600]); + ZA[487] = ZR15(ZA[482]) + ZA[485]; + ZA[603] = ZA[528] + 0x5cb0a9dcU; + + ZA[502] = ZA[497] + ZA[487]; + ZA[739] = ZA[591] + ZA[738]; + ZA[604] = ZA[593] + ZA[603]; + ZA[737] = ZA[744] + ZA[632]; + + ZA[741] = (ZCh(ZA[739], ZA[736], ZA[598]) + ZA[604]) + ZR26(ZA[739]); + ZA[745] = ZMa(ZA[600], ZA[595], ZA[737]) + ZR30(ZA[737]); + ZA[486] = ZA[471] + 0x80000000U; + ZA[606] = ZA[502] + 0x76f988daU; + + ZA[537] = ZR15(ZA[528]) + ZA[486]; + ZA[742] = ZA[595] + ZA[741]; + ZA[613] = ZA[598] + ZA[606]; + ZA[740] = ZA[745] + ZA[738]; + + ZA[747] = (ZCh(ZA[742], ZA[739], ZA[736]) + ZA[613]) + ZR26(ZA[742]); + ZA[746] = ZMa(ZA[737], ZA[600], ZA[740]) + ZR30(ZA[740]); + ZA[607] = ZA[537] + 0x983e5152U; + + ZA[546] = ZR15(ZA[502]) + ZA[501]; + ZA[751] = ZA[736] + ZA[607]; + ZA[748] = ZA[600] + ZA[747]; + ZA[743] = ZA[746] + ZA[741]; + + ZA[752] = (ZCh(ZA[748], ZA[742], ZA[739]) + ZA[751]) + ZR26(ZA[748]); + ZA[749] = ZMa(ZA[740], ZA[737], ZA[743]) + ZR30(ZA[743]); + ZA[608] = ZA[546] + 0xa831c66dU; + + ZA[554] = ZR15(ZA[537]) + ZA[474]; + ZA[756] = ZA[739] + ZA[608]; + ZA[753] = ZA[737] + ZA[752]; + ZA[750] = ZA[747] + ZA[749]; + + ZA[757] = (ZCh(ZA[753], ZA[748], ZA[742]) + ZA[756]) + ZR26(ZA[753]); + ZA[754] = ZMa(ZA[743], ZA[740], ZA[750]) + ZR30(ZA[750]); + ZA[609] = ZA[554] + 0xb00327c8U; + + ZA[566] = ZR15(ZA[546]) + ZA[518]; + ZA[761] = ZA[742] + ZA[609]; + ZA[758] = ZA[740] + ZA[757]; + ZA[755] = ZA[752] + ZA[754]; + + ZA[762] = (ZCh(ZA[758], ZA[753], ZA[748]) + ZA[761]) + ZR26(ZA[758]); + ZA[759] = ZMa(ZA[750], ZA[743], ZA[755]) + ZR30(ZA[755]); + ZA[610] = ZA[566] + 0xbf597fc7U; + + ZA[567] = ZR15(ZA[554]) + ZA[482]; + ZA[766] = ZA[748] + ZA[610]; + ZA[763] = ZA[743] + ZA[762]; + ZA[760] = ZA[757] + ZA[759]; + + ZA[767] = (ZCh(ZA[763], ZA[758], ZA[753]) + ZA[766]) + ZR26(ZA[763]); + ZA[764] = ZMa(ZA[755], ZA[750], ZA[760]) + ZR30(ZA[760]); + ZA[611] = ZA[567] + 0xc6e00bf3U; + + ZA[614] = ZR15(ZA[566]) + ZA[528]; + ZA[771] = ZA[753] + ZA[611]; + ZA[768] = ZA[750] + ZA[767]; + ZA[765] = ZA[762] + ZA[764]; + + ZA[772] = (ZCh(ZA[768], ZA[763], ZA[758]) + ZA[771]) + ZR26(ZA[768]); + ZA[769] = ZMa(ZA[760], ZA[755], ZA[765]) + ZR30(ZA[765]); + ZA[612] = ZA[502] + 0x00400022U; + ZA[615] = ZA[614] + 0xd5a79147U; + + ZA[616] = ZR15(ZA[567]) + ZA[612]; + ZA[504] = ZR25(ZA[497]) + 0x00000100U; + ZA[776] = ZA[758] + ZA[615]; + ZA[773] = ZA[755] + ZA[772]; + ZA[770] = ZA[767] + ZA[769]; + + ZA[777] = (ZCh(ZA[773], ZA[768], ZA[763]) + ZA[776]) + ZR26(ZA[773]); + ZA[774] = ZMa(ZA[765], ZA[760], ZA[770]) + ZR30(ZA[770]); + ZA[492] = ZR25(ZA[471]); + ZA[618] = ZA[537] + ZA[504]; + ZA[617] = ZA[616] + 0x06ca6351U; + + ZA[619] = ZR15(ZA[614]) + ZA[618]; + ZA[781] = ZA[763] + ZA[617]; + ZA[778] = ZA[760] + ZA[777]; + ZA[775] = ZA[772] + ZA[774]; + ZA[505] = ZA[492] + ZA[497]; + + ZA[782] = (ZCh(ZA[778], ZA[773], ZA[768]) + ZA[781]) + ZR26(ZA[778]); + ZA[779] = ZMa(ZA[770], ZA[765], ZA[775]) + ZR30(ZA[775]); + ZA[621] = ZA[505] + ZA[546]; + ZA[620] = ZA[619] + 0x14292967U; + + ZA[622] = ZR15(ZA[616]) + ZA[621]; + ZA[625] = ZR25(ZA[501]); + ZA[786] = ZA[768] + ZA[620]; + ZA[783] = ZA[765] + ZA[782]; + ZA[624] = ZA[554] + ZA[471]; + ZA[780] = ZA[777] + ZA[779]; + + ZA[787] = (ZCh(ZA[783], ZA[778], ZA[773]) + ZA[786]) + ZR26(ZA[783]); + ZA[784] = ZMa(ZA[775], ZA[770], ZA[780]) + ZR30(ZA[780]); + ZA[493] = ZR25(ZA[474]); + ZA[626] = ZA[625] + ZA[624]; + ZA[623] = ZA[622] + 0x27b70a85U; + + ZA[627] = ZR15(ZA[619]) + ZA[626]; + ZA[791] = ZA[773] + ZA[623]; + ZA[788] = ZA[770] + ZA[787]; + ZA[785] = ZA[782] + ZA[784]; + ZA[629] = ZA[493] + ZA[501]; + + ZA[792] = (ZCh(ZA[788], ZA[783], ZA[778]) + ZA[791]) + ZR26(ZA[788]); + ZA[789] = ZMa(ZA[780], ZA[775], ZA[785]) + ZR30(ZA[785]); + ZA[630] = ZA[566] + ZA[629]; + ZA[628] = ZA[627] + 0x2e1b2138U; + + ZA[634] = ZR25(ZA[518]) + ZA[474]; + ZA[631] = ZR15(ZA[622]) + ZA[630]; + ZA[796] = ZA[778] + ZA[628]; + ZA[793] = ZA[775] + ZA[792]; + ZA[790] = ZA[787] + ZA[789]; + + ZA[797] = (ZCh(ZA[793], ZA[788], ZA[783]) + ZA[796]) + ZR26(ZA[793]); + ZA[794] = ZMa(ZA[785], ZA[780], ZA[790]) + ZR30(ZA[790]); + ZA[491] = ZR25(ZA[482]); + ZA[635] = ZA[567] + ZA[634]; + ZA[633] = ZA[631] + 0x4d2c6dfcU; + + ZA[636] = ZR15(ZA[627]) + ZA[635]; + ZA[801] = ZA[783] + ZA[633]; + ZA[798] = ZA[780] + ZA[797]; + ZA[795] = ZA[792] + ZA[794]; + ZA[638] = ZA[491] + ZA[518]; + + ZA[802] = (ZCh(ZA[798], ZA[793], ZA[788]) + ZA[801]) + ZR26(ZA[798]); + ZA[799] = ZMa(ZA[790], ZA[785], ZA[795]) + ZR30(ZA[795]); + ZA[639] = ZA[638] + ZA[614]; + ZA[637] = ZA[636] + 0x53380d13U; + + ZA[642] = ZR25(ZA[528]) + ZA[482]; + ZA[640] = ZR15(ZA[631]) + ZA[639]; + ZA[806] = ZA[788] + ZA[637]; + ZA[803] = ZA[785] + ZA[802]; + ZA[800] = ZA[797] + ZA[799]; + + ZA[807] = (ZCh(ZA[803], ZA[798], ZA[793]) + ZA[806]) + ZR26(ZA[803]); + ZA[804] = ZMa(ZA[795], ZA[790], ZA[800]) + ZR30(ZA[800]); + ZA[643] = ZA[616] + ZA[642]; + ZA[641] = ZA[640] + 0x650a7354U; + + ZA[646] = ZR25(ZA[502]) + ZA[528]; + ZA[644] = ZR15(ZA[636]) + ZA[643]; + ZA[811] = ZA[793] + ZA[641]; + ZA[808] = ZA[790] + ZA[807]; + ZA[805] = ZA[802] + ZA[804]; + + ZA[812] = (ZCh(ZA[808], ZA[803], ZA[798]) + ZA[811]) + ZR26(ZA[808]); + ZA[809] = ZMa(ZA[800], ZA[795], ZA[805]) + ZR30(ZA[805]); + ZA[647] = ZA[619] + ZA[646]; + ZA[645] = ZA[644] + 0x766a0abbU; + + ZA[650] = ZR25(ZA[537]) + ZA[502]; + ZA[648] = ZR15(ZA[640]) + ZA[647]; + ZA[816] = ZA[798] + ZA[645]; + ZA[813] = ZA[795] + ZA[812]; + ZA[810] = ZA[807] + ZA[809]; + + ZA[817] = (ZCh(ZA[813], ZA[808], ZA[803]) + ZA[816]) + ZR26(ZA[813]); + ZA[814] = ZMa(ZA[805], ZA[800], ZA[810]) + ZR30(ZA[810]); + ZA[925] = ZA[622] + ZA[650]; + ZA[649] = ZA[648] + 0x81c2c92eU; + + ZA[653] = ZR25(ZA[546]) + ZA[537]; + ZA[651] = ZR15(ZA[644]) + ZA[925]; + ZA[821] = ZA[803] + ZA[649]; + ZA[818] = ZA[800] + ZA[817]; + ZA[815] = ZA[812] + ZA[814]; + + ZA[822] = (ZCh(ZA[818], ZA[813], ZA[808]) + ZA[821]) + ZR26(ZA[818]); + ZA[819] = ZMa(ZA[810], ZA[805], ZA[815]) + ZR30(ZA[815]); + ZA[654] = ZA[627] + ZA[653]; + ZA[652] = ZA[651] + 0x92722c85U; + + ZA[657] = ZR25(ZA[554]) + ZA[546]; + ZA[655] = ZR15(ZA[648]) + ZA[654]; + ZA[826] = ZA[808] + ZA[652]; + ZA[823] = ZA[805] + ZA[822]; + ZA[820] = ZA[817] + ZA[819]; + + ZA[827] = (ZCh(ZA[823], ZA[818], ZA[813]) + ZA[826]) + ZR26(ZA[823]); + ZA[824] = ZMa(ZA[815], ZA[810], ZA[820]) + ZR30(ZA[820]); + ZA[658] = ZA[631] + ZA[657]; + ZA[656] = ZA[655] + 0xa2bfe8a1U; + + ZA[661] = ZR25(ZA[566]) + ZA[554]; + ZA[659] = ZR15(ZA[651]) + ZA[658]; + ZA[831] = ZA[813] + ZA[656]; + ZA[828] = ZA[810] + ZA[827]; + ZA[825] = ZA[822] + ZA[824]; + + ZA[832] = (ZCh(ZA[828], ZA[823], ZA[818]) + ZA[831]) + ZR26(ZA[828]); + ZA[829] = ZMa(ZA[820], ZA[815], ZA[825]) + ZR30(ZA[825]); + ZA[662] = ZA[636] + ZA[661]; + ZA[660] = ZA[659] + 0xa81a664bU; + + ZA[665] = ZR25(ZA[567]) + ZA[566]; + ZA[663] = ZR15(ZA[655]) + ZA[662]; + ZA[836] = ZA[818] + ZA[660]; + ZA[833] = ZA[815] + ZA[832]; + ZA[830] = ZA[827] + ZA[829]; + + ZA[837] = (ZCh(ZA[833], ZA[828], ZA[823]) + ZA[836]) + ZR26(ZA[833]); + ZA[834] = ZMa(ZA[825], ZA[820], ZA[830]) + ZR30(ZA[830]); + ZA[666] = ZA[640] + ZA[665]; + ZA[664] = ZA[663] + 0xc24b8b70U; + + ZA[669] = ZR25(ZA[614]) + ZA[567]; + ZA[667] = ZR15(ZA[659]) + ZA[666]; + ZA[841] = ZA[823] + ZA[664]; + ZA[838] = ZA[820] + ZA[837]; + ZA[835] = ZA[832] + ZA[834]; + + ZA[842] = (ZCh(ZA[838], ZA[833], ZA[828]) + ZA[841]) + ZR26(ZA[838]); + ZA[839] = ZMa(ZA[830], ZA[825], ZA[835]) + ZR30(ZA[835]); + ZA[670] = ZA[644] + ZA[669]; + ZA[668] = ZA[667] + 0xc76c51a3U; + + ZA[677] = ZR25(ZA[616]) + ZA[614]; + ZA[671] = ZR15(ZA[663]) + ZA[670]; + ZA[846] = ZA[828] + ZA[668]; + ZA[843] = ZA[825] + ZA[842]; + ZA[840] = ZA[837] + ZA[839]; + + ZA[847] = (ZCh(ZA[843], ZA[838], ZA[833]) + ZA[846]) + ZR26(ZA[843]); + ZA[844] = ZMa(ZA[835], ZA[830], ZA[840]) + ZR30(ZA[840]); + ZA[678] = ZA[648] + ZA[677]; + ZA[676] = ZA[671] + 0xd192e819U; + + ZA[682] = ZR25(ZA[619]) + ZA[616]; + ZA[679] = ZR15(ZA[667]) + ZA[678]; + ZA[851] = ZA[833] + ZA[676]; + ZA[848] = ZA[830] + ZA[847]; + ZA[845] = ZA[842] + ZA[844]; + + ZA[852] = (ZCh(ZA[848], ZA[843], ZA[838]) + ZA[851]) + ZR26(ZA[848]); + ZA[849] = ZMa(ZA[840], ZA[835], ZA[845]) + ZR30(ZA[845]); + ZA[683] = ZA[651] + ZA[682]; + ZA[680] = ZA[679] + 0xd6990624U; + + ZA[686] = ZR25(ZA[622]) + ZA[619]; + ZA[684] = ZR15(ZA[671]) + ZA[683]; + ZA[856] = ZA[838] + ZA[680]; + ZA[853] = ZA[835] + ZA[852]; + ZA[850] = ZA[847] + ZA[849]; + + ZA[857] = (ZCh(ZA[853], ZA[848], ZA[843]) + ZA[856]) + ZR26(ZA[853]); + ZA[854] = ZMa(ZA[845], ZA[840], ZA[850]) + ZR30(ZA[850]); + ZA[687] = ZA[655] + ZA[686]; + ZA[685] = ZA[684] + 0xf40e3585U; + + ZA[690] = ZR25(ZA[627]) + ZA[622]; + ZA[688] = ZR15(ZA[679]) + ZA[687]; + ZA[861] = ZA[843] + ZA[685]; + ZA[858] = ZA[840] + ZA[857]; + ZA[855] = ZA[852] + ZA[854]; + + ZA[862] = (ZCh(ZA[858], ZA[853], ZA[848]) + ZA[861]) + ZR26(ZA[858]); + ZA[859] = ZMa(ZA[850], ZA[845], ZA[855]) + ZR30(ZA[855]); + ZA[691] = ZA[659] + ZA[690]; + ZA[689] = ZA[688] + 0x106aa070U; + + ZA[694] = ZR25(ZA[631]) + ZA[627]; + ZA[692] = ZR15(ZA[684]) + ZA[691]; + ZA[866] = ZA[848] + ZA[689]; + ZA[863] = ZA[845] + ZA[862]; + ZA[860] = ZA[857] + ZA[859]; + + ZA[867] = (ZCh(ZA[863], ZA[858], ZA[853]) + ZA[866]) + ZR26(ZA[863]); + ZA[864] = ZMa(ZA[855], ZA[850], ZA[860]) + ZR30(ZA[860]); + ZA[695] = ZA[663] + ZA[694]; + ZA[693] = ZA[692] + 0x19a4c116U; + + ZA[698] = ZR25(ZA[636]) + ZA[631]; + ZA[696] = ZR15(ZA[688]) + ZA[695]; + ZA[871] = ZA[853] + ZA[693]; + ZA[868] = ZA[850] + ZA[867]; + ZA[865] = ZA[862] + ZA[864]; + + ZA[873] = (ZCh(ZA[868], ZA[863], ZA[858]) + ZA[871]) + ZR26(ZA[868]); + ZA[869] = ZMa(ZA[860], ZA[855], ZA[865]) + ZR30(ZA[865]); + ZA[699] = ZA[667] + ZA[698]; + ZA[697] = ZA[696] + 0x1e376c08U; + + ZA[702] = ZR25(ZA[640]) + ZA[636]; + ZA[700] = ZR15(ZA[692]) + ZA[699]; + ZA[877] = ZA[858] + ZA[697]; + ZA[874] = ZA[855] + ZA[873]; + ZA[870] = ZA[867] + ZA[869]; + + ZA[878] = (ZCh(ZA[874], ZA[868], ZA[863]) + ZA[877]) + ZR26(ZA[874]); + ZA[875] = ZMa(ZA[865], ZA[860], ZA[870]) + ZR30(ZA[870]); + ZA[703] = ZA[671] + ZA[702]; + ZA[701] = ZA[700] + 0x2748774cU; + + ZA[706] = ZR25(ZA[644]) + ZA[640]; + ZA[704] = ZR15(ZA[696]) + ZA[703]; + ZA[882] = ZA[863] + ZA[701]; + ZA[879] = ZA[860] + ZA[878]; + ZA[876] = ZA[873] + ZA[875]; + + ZA[883] = (ZCh(ZA[879], ZA[874], ZA[868]) + ZA[882]) + ZR26(ZA[879]); + ZA[880] = ZMa(ZA[870], ZA[865], ZA[876]) + ZR30(ZA[876]); + ZA[707] = ZA[679] + ZA[706]; + ZA[705] = ZA[704] + 0x34b0bcb5U; + + ZA[710] = ZR25(ZA[648]) + ZA[644]; + ZA[708] = ZR15(ZA[700]) + ZA[707]; + ZA[887] = ZA[868] + ZA[705]; + ZA[884] = ZA[865] + ZA[883]; + ZA[881] = ZA[878] + ZA[880]; + + ZA[888] = (ZCh(ZA[884], ZA[879], ZA[874]) + ZA[887]) + ZR26(ZA[884]); + ZA[885] = ZMa(ZA[876], ZA[870], ZA[881]) + ZR30(ZA[881]); + ZA[711] = ZA[684] + ZA[710]; + ZA[709] = ZA[708] + 0x391c0cb3U; + + ZA[714] = ZR25(ZA[651]) + ZA[648]; + ZA[712] = ZR15(ZA[704]) + ZA[711]; + ZA[892] = ZA[874] + ZA[709]; + ZA[889] = ZA[870] + ZA[888]; + ZA[886] = ZA[883] + ZA[885]; + + ZA[893] = (ZCh(ZA[889], ZA[884], ZA[879]) + ZA[892]) + ZR26(ZA[889]); + ZA[890] = ZMa(ZA[881], ZA[876], ZA[886]) + ZR30(ZA[886]); + ZA[715] = ZA[688] + ZA[714]; + ZA[713] = ZA[712] + 0x4ed8aa4aU; + + ZA[718] = ZR25(ZA[655]) + ZA[651]; + ZA[716] = ZR15(ZA[708]) + ZA[715]; + ZA[897] = ZA[879] + ZA[713]; + ZA[894] = ZA[876] + ZA[893]; + ZA[891] = ZA[888] + ZA[890]; + + ZA[898] = (ZCh(ZA[894], ZA[889], ZA[884]) + ZA[897]) + ZR26(ZA[894]); + ZA[895] = ZMa(ZA[886], ZA[881], ZA[891]) + ZR30(ZA[891]); + ZA[719] = ZA[692] + ZA[718]; + ZA[717] = ZA[716] + 0x5b9cca4fU; + + ZA[722] = ZR25(ZA[659]) + ZA[655]; + ZA[720] = ZR15(ZA[712]) + ZA[719]; + ZA[902] = ZA[884] + ZA[717]; + ZA[899] = ZA[881] + ZA[898]; + ZA[896] = ZA[893] + ZA[895]; + + ZA[903] = (ZCh(ZA[899], ZA[894], ZA[889]) + ZA[902]) + ZR26(ZA[899]); + ZA[900] = ZMa(ZA[891], ZA[886], ZA[896]) + ZR30(ZA[896]); + ZA[723] = ZA[696] + ZA[722]; + ZA[721] = ZA[720] + 0x682e6ff3U; + + ZA[672] = ZR25(ZA[663]) + ZA[659]; + ZA[724] = ZR15(ZA[716]) + ZA[723]; + ZA[907] = ZA[889] + ZA[721]; + ZA[904] = ZA[886] + ZA[903]; + ZA[901] = ZA[898] + ZA[900]; + + ZA[908] = (ZCh(ZA[904], ZA[899], ZA[894]) + ZA[907]) + ZR26(ZA[904]); + ZA[905] = ZMa(ZA[896], ZA[891], ZA[901]) + ZR30(ZA[901]); + ZA[673] = ZR25(ZA[667]) + ZA[663]; + ZA[726] = ZA[700] + ZA[672]; + ZA[725] = ZA[724] + 0x748f82eeU; + + ZA[727] = ZR15(ZA[720]) + ZA[726]; + ZA[912] = ZA[894] + ZA[725]; + ZA[909] = ZA[891] + ZA[908]; + ZA[906] = ZA[903] + ZA[905]; + ZA[675] = ZA[667] + 0x8cc70208U; + ZA[729] = ZA[704] + ZA[673]; + + ZA[913] = (ZCh(ZA[909], ZA[904], ZA[899]) + ZA[912]) + ZR26(ZA[909]); + ZA[910] = ZMa(ZA[901], ZA[896], ZA[906]) + ZR30(ZA[906]); + ZA[674] = ZR25(ZA[671]) + ZA[675]; + ZA[730] = ZR15(ZA[724]) + ZA[729]; + ZA[728] = ZA[727] + 0x78a5636fU; + + ZA[681] = ZR25(ZA[679]) + ZA[671]; + ZA[917] = ZA[899] + ZA[901] + ZA[728]; + ZA[914] = ZA[896] + ZA[913]; + ZA[911] = ZA[908] + ZA[910]; + ZA[732] = ZA[708] + ZA[674]; + ZA[731] = ZA[730] + 0x84c87814U; + + ZA[918] = (ZCh(ZA[914], ZA[909], ZA[904]) + ZA[917]) + ZR26(ZA[914]); + ZA[915] = ZMa(ZA[906], ZA[901], ZA[911]) + ZR30(ZA[911]); + ZA[733] = ZR15(ZA[727]) + ZA[732]; + ZA[919] = ZA[906] + ZA[904] + ZA[731]; + ZA[734] = ZA[712] + ZA[681]; + + ZA[920] = (ZCh(ZA[918], ZA[914], ZA[909]) + ZA[919]) + ZR26(ZA[918]); + ZA[735] = ZR15(ZA[730]) + ZA[734]; + ZA[921] = ZA[911] + ZA[909] + ZA[733]; + ZA[916] = ZA[913] + ZA[915]; + + ZA[922] = (ZCh(ZA[920], ZA[918], ZA[914]) + ZA[921]) + ZR26(ZA[920]); + ZA[923] = ZA[916] + ZA[914] + ZA[735]; + + ZA[924] = (ZCh(ZA[922], ZA[920], ZA[918]) + ZA[923]) + ZR26(ZA[922]); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#if defined(VECTORS4) + bool result = any(ZA[924] == 0x136032EDU); + + if (result) { + if (ZA[924].x == 0x136032EDU) + SETFOUND(Znonce.x); + if (ZA[924].y == 0x136032EDU) + SETFOUND(Znonce.y); + if (ZA[924].z == 0x136032EDU) + SETFOUND(Znonce.z); + if (ZA[924].w == 0x136032EDU) + SETFOUND(Znonce.w); + } +#elif defined(VECTORS2) + bool result = any(ZA[924] == 0x136032EDU); + + if (result) { + if (ZA[924].x == 0x136032EDU) + SETFOUND(Znonce.x); + if (ZA[924].y == 0x136032EDU) + SETFOUND(Znonce.y); + } +#else + if (ZA[924] == 0x136032EDU) + SETFOUND(Znonce); +#endif +} diff --git a/bfgminer3.9/bin/diablo130302.cl b/bfgminer3.9/bin/diablo130302.cl new file mode 100755 index 0000000..a721803 --- /dev/null +++ b/bfgminer3.9/bin/diablo130302.cl @@ -0,0 +1,1361 @@ +/* + * DiabloMiner - OpenCL miner for BitCoin + * Copyright (C) 2012, 2013 Con Kolivas + * Copyright (C) 2010, 2011, 2012 Patrick McFarland + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more detail). + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifdef VECTORS4 + typedef uint4 z; +#elif defined(VECTORS2) + typedef uint2 z; +#else + typedef uint z; +#endif + +#ifdef BITALIGN +#pragma OPENCL EXTENSION cl_amd_media_ops : enable +#define Zrotr(a, b) amd_bitalign((z)a, (z)a, (z)(32 - b)) +#else +#define Zrotr(a, b) rotate((z)a, (z)b) +#endif + +#ifdef BFI_INT +#define ZCh(a, b, c) amd_bytealign(a, b, c) +#define ZMa(a, b, c) amd_bytealign((c ^ a), (b), (a)) +#else +#define ZCh(a, b, c) bitselect((z)c, (z)b, (z)a) +#define ZMa(a, b, c) bitselect((z)a, (z)b, (z)c ^ (z)a) +#endif + +/* These constants are not the classic SHA256 constants but the order that + * constants are used in this kernel. + */ +__constant uint K[] = { + 0xd807aa98U, + 0x12835b01U, + 0x243185beU, + 0x550c7dc3U, + 0x72be5d74U, + 0x80deb1feU, + 0x9bdc06a7U, + 0xc19bf3f4U, + 0x0fc19dc6U, + 0x240ca1ccU, + 0x80000000U, // 10 + 0x2de92c6fU, + 0x4a7484aaU, + 0x00000280U, + 0x5cb0a9dcU, + 0x76f988daU, + 0x983e5152U, + 0xa831c66dU, + 0xb00327c8U, + 0xbf597fc7U, + 0xc6e00bf3U, // 20 + 0x00A00055U, + 0xd5a79147U, + 0x06ca6351U, + 0x14292967U, + 0x27b70a85U, + 0x2e1b2138U, + 0x4d2c6dfcU, + 0x53380d13U, + 0x650a7354U, + 0x766a0abbU, // 30 + 0x81c2c92eU, + 0x92722c85U, + 0xa2bfe8a1U, + 0xa81a664bU, + 0xc24b8b70U, + 0xc76c51a3U, + 0xd192e819U, + 0xd6990624U, + 0xf40e3585U, + 0x106aa070U, // 40 + 0x19a4c116U, + 0x1e376c08U, + 0x2748774cU, + 0x34b0bcb5U, + 0x391c0cb3U, + 0x4ed8aa4aU, + 0x5b9cca4fU, + 0x682e6ff3U, + 0x748f82eeU, + 0x78a5636fU, // 50 + 0x84c87814U, + 0x8cc70208U, + 0x90befffaU, + 0xa4506cebU, + 0xbef9a3f7U, + 0xc67178f2U, + 0x98c7e2a2U, + 0x90bb1e3cU, + 0x510e527fU, + 0x9b05688cU, // 60 + 0xfc08884dU, + 0x3c6ef372U, + 0x50c6645bU, + 0x6a09e667U, + 0xbb67ae85U, + 0x3ac42e24U, + 0xd21ea4fdU, + 0x59f111f1U, + 0x923f82a4U, + 0xab1c5ed5U, // 70 + 0x5807aa98U, + 0xc19bf274U, + 0xe49b69c1U, + 0x00a00000U, + 0xefbe4786U, + 0x00000100U, + 0x11002000U, + 0x00400022U, + 0x136032EDU +}; + +#define ZR25(n) ((Zrotr((n), 25) ^ Zrotr((n), 14) ^ ((n) >> 3U))) +#define ZR15(n) ((Zrotr((n), 15) ^ Zrotr((n), 13) ^ ((n) >> 10U))) +#define ZR26(n) ((Zrotr((n), 26) ^ Zrotr((n), 21) ^ Zrotr((n), 7))) +#define ZR30(n) ((Zrotr((n), 30) ^ Zrotr((n), 19) ^ Zrotr((n), 10))) + +__kernel +__attribute__((vec_type_hint(z))) +__attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) +void search( +#ifndef GOFFSET + const z base, +#endif + const uint PreVal4_state0, const uint PreVal4_state0_k7, + const uint PreVal4_T1, + const uint W18, const uint W19, + const uint W16, const uint W17, + const uint W16_plus_K16, const uint W17_plus_K17, + const uint W31, const uint W32, + const uint d1, const uint b1, const uint c1, + const uint h1, const uint f1, const uint g1, + const uint c1_plus_k5, const uint b1_plus_k6, + const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + volatile __global uint * output) +{ + + z ZA[930]; + +#ifdef GOFFSET + const z Znonce = (uint)(get_global_id(0)); +#else + const z Znonce = base + (uint)(get_global_id(0)); +#endif + + ZA[15] = Znonce + PreVal4_state0; + + ZA[16] = (ZCh(ZA[15], b1, c1) + d1) + ZR26(ZA[15]); + ZA[26] = Znonce + PreVal4_T1; + + ZA[27] = ZMa(f1, g1, ZA[26]) + ZR30(ZA[26]); + ZA[17] = ZA[16] + h1; + + ZA[19] = (ZCh(ZA[17], ZA[15], b1) + c1_plus_k5) + ZR26(ZA[17]); + ZA[28] = ZA[27] + ZA[16]; + + ZA[548] = ZMa(ZA[26], f1, ZA[28]) + ZR30(ZA[28]); + ZA[20] = ZA[19] + g1; + + ZA[22] = (ZCh(ZA[20], ZA[17], ZA[15]) + b1_plus_k6) + ZR26(ZA[20]); + ZA[29] = ZA[548] + ZA[19]; + + ZA[549] = ZMa(ZA[28], ZA[26], ZA[29]) + ZR30(ZA[29]); + ZA[23] = ZA[22] + f1; + + ZA[24] = ZCh(ZA[23], ZA[20], ZA[17]) + ZR26(ZA[23]); + ZA[180] = Znonce + PreVal4_state0_k7; + ZA[30] = ZA[549] + ZA[22]; + + ZA[31] = ZMa(ZA[29], ZA[28], ZA[30]) + ZR30(ZA[30]); + ZA[181] = ZA[180] + ZA[24]; + + ZA[182] = ZA[181] + ZA[26]; + ZA[183] = ZA[181] + ZA[31]; + ZA[18] = ZA[17] + K[0]; + + ZA[186] = (ZCh(ZA[182], ZA[23], ZA[20]) + ZA[18]) + ZR26(ZA[182]); + ZA[184] = ZMa(ZA[30], ZA[29], ZA[183]) + ZR30(ZA[183]); + + ZA[187] = ZA[186] + ZA[28]; + ZA[188] = ZA[186] + ZA[184]; + ZA[21] = ZA[20] + K[1]; + + ZA[191] = (ZCh(ZA[187], ZA[182], ZA[23]) + ZA[21]) + ZR26(ZA[187]); + ZA[189] = ZMa(ZA[183], ZA[30], ZA[188]) + ZR30(ZA[188]); + + ZA[192] = ZA[191] + ZA[29]; + ZA[193] = ZA[191] + ZA[189]; + ZA[25] = ZA[23] + K[2]; + + ZA[196] = (ZCh(ZA[192], ZA[187], ZA[182]) + ZA[25]) + ZR26(ZA[192]); + ZA[194] = ZMa(ZA[188], ZA[183], ZA[193]) + ZR30(ZA[193]); + + ZA[197] = ZA[196] + ZA[30]; + ZA[198] = ZA[196] + ZA[194]; + ZA[185] = ZA[182] + K[3]; + + ZA[201] = (ZCh(ZA[197], ZA[192], ZA[187]) + ZA[185]) + ZR26(ZA[197]); + ZA[199] = ZMa(ZA[193], ZA[188], ZA[198]) + ZR30(ZA[198]); + + ZA[202] = ZA[201] + ZA[183]; + ZA[203] = ZA[201] + ZA[199]; + ZA[190] = ZA[187] + K[4]; + + ZA[206] = (ZCh(ZA[202], ZA[197], ZA[192]) + ZA[190]) + ZR26(ZA[202]); + ZA[204] = ZMa(ZA[198], ZA[193], ZA[203]) + ZR30(ZA[203]); + + ZA[207] = ZA[206] + ZA[188]; + ZA[208] = ZA[206] + ZA[204]; + ZA[195] = ZA[192] + K[5]; + + ZA[211] = (ZCh(ZA[207], ZA[202], ZA[197]) + ZA[195]) + ZR26(ZA[207]); + ZA[209] = ZMa(ZA[203], ZA[198], ZA[208]) + ZR30(ZA[208]); + + ZA[212] = ZA[193] + ZA[211]; + ZA[213] = ZA[211] + ZA[209]; + ZA[200] = ZA[197] + K[6]; + + ZA[216] = (ZCh(ZA[212], ZA[207], ZA[202]) + ZA[200]) + ZR26(ZA[212]); + ZA[214] = ZMa(ZA[208], ZA[203], ZA[213]) + ZR30(ZA[213]); + + ZA[217] = ZA[198] + ZA[216]; + ZA[218] = ZA[216] + ZA[214]; + ZA[205] = ZA[202] + K[7]; + + ZA[220] = (ZCh(ZA[217], ZA[212], ZA[207]) + ZA[205]) + ZR26(ZA[217]); + ZA[219] = ZMa(ZA[213], ZA[208], ZA[218]) + ZR30(ZA[218]); + + ZA[222] = ZA[203] + ZA[220]; + ZA[223] = ZA[220] + ZA[219]; + ZA[210] = ZA[207] + W16_plus_K16; + + ZA[226] = (ZCh(ZA[222], ZA[217], ZA[212]) + ZA[210]) + ZR26(ZA[222]); + ZA[225] = ZMa(ZA[218], ZA[213], ZA[223]) + ZR30(ZA[223]); + + ZA[0] = ZR25(Znonce) + W18; + ZA[228] = ZA[226] + ZA[225]; + ZA[227] = ZA[208] + ZA[226]; + ZA[215] = ZA[212] + W17_plus_K17; + + ZA[231] = (ZCh(ZA[227], ZA[222], ZA[217]) + ZA[215]) + ZR26(ZA[227]); + ZA[229] = ZMa(ZA[223], ZA[218], ZA[228]) + ZR30(ZA[228]); + ZA[1] = ZA[0] + K[8]; + + ZA[232] = ZA[213] + ZA[231]; + ZA[233] = ZA[231] + ZA[229]; + ZA[221] = ZA[217] + ZA[1]; + ZA[32] = Znonce + W19; + + ZA[236] = (ZCh(ZA[232], ZA[227], ZA[222]) + ZA[221]) + ZR26(ZA[232]); + ZA[234] = ZMa(ZA[228], ZA[223], ZA[233]) + ZR30(ZA[233]); + ZA[33] = ZA[32] + K[9]; + + ZA[3] = ZR15(ZA[0]) + K[10]; + ZA[238] = ZA[236] + ZA[234]; + ZA[237] = ZA[218] + ZA[236]; + ZA[224] = ZA[222] + ZA[33]; + + ZA[241] = (ZCh(ZA[237], ZA[232], ZA[227]) + ZA[224]) + ZR26(ZA[237]); + ZA[239] = ZMa(ZA[233], ZA[228], ZA[238]) + ZR30(ZA[238]); + ZA[4] = ZA[3] + K[11]; + + ZA[35] = ZR15(ZA[32]); + ZA[243] = ZA[241] + ZA[239]; + ZA[242] = ZA[223] + ZA[241]; + ZA[230] = ZA[227] + ZA[4]; + + ZA[246] = (ZCh(ZA[242], ZA[237], ZA[232]) + ZA[230]) + ZR26(ZA[242]); + ZA[244] = ZMa(ZA[238], ZA[233], ZA[243]) + ZR30(ZA[243]); + ZA[36] = ZA[35] + K[12]; + + ZA[7] = ZR15(ZA[3]) + K[13]; + ZA[248] = ZA[246] + ZA[244]; + ZA[247] = ZA[228] + ZA[246]; + ZA[235] = ZA[232] + ZA[36]; + + ZA[251] = (ZCh(ZA[247], ZA[242], ZA[237]) + ZA[235]) + ZR26(ZA[247]); + ZA[249] = ZMa(ZA[243], ZA[238], ZA[248]) + ZR30(ZA[248]); + ZA[8] = ZA[7] + K[14]; + + ZA[38] = ZR15(ZA[35]) + W16; + ZA[253] = ZA[251] + ZA[249]; + ZA[252] = ZA[233] + ZA[251]; + ZA[240] = ZA[237] + ZA[8]; + + ZA[256] = (ZCh(ZA[252], ZA[247], ZA[242]) + ZA[240]) + ZR26(ZA[252]); + ZA[254] = ZMa(ZA[248], ZA[243], ZA[253]) + ZR30(ZA[253]); + ZA[40] = ZA[38] + K[15]; + + ZA[10] = ZR15(ZA[7]) + W17; + ZA[258] = ZA[256] + ZA[254]; + ZA[257] = ZA[238] + ZA[256]; + ZA[245] = ZA[242] + ZA[40]; + + ZA[261] = (ZCh(ZA[257], ZA[252], ZA[247]) + ZA[245]) + ZR26(ZA[257]); + ZA[259] = ZMa(ZA[253], ZA[248], ZA[258]) + ZR30(ZA[258]); + ZA[13] = ZA[10] + K[16]; + + ZA[43] = ZR15(ZA[38]) + ZA[0]; + ZA[263] = ZA[261] + ZA[259]; + ZA[262] = ZA[243] + ZA[261]; + ZA[250] = ZA[247] + ZA[13]; + + ZA[266] = (ZCh(ZA[262], ZA[257], ZA[252]) + ZA[250]) + ZR26(ZA[262]); + ZA[264] = ZMa(ZA[258], ZA[253], ZA[263]) + ZR30(ZA[263]); + ZA[11] = ZR15(ZA[10]); + ZA[45] = ZA[43] + K[17]; + + ZA[52] = ZA[11] + ZA[32]; + ZA[267] = ZA[248] + ZA[266]; + ZA[255] = ZA[252] + ZA[45]; + ZA[268] = ZA[266] + ZA[264]; + + ZA[271] = (ZCh(ZA[267], ZA[262], ZA[257]) + ZA[255]) + ZR26(ZA[267]); + ZA[269] = ZMa(ZA[263], ZA[258], ZA[268]) + ZR30(ZA[268]); + ZA[54] = ZA[52] + K[18]; + + ZA[48] = ZR15(ZA[43]) + ZA[3]; + ZA[273] = ZA[271] + ZA[269]; + ZA[272] = ZA[253] + ZA[271]; + ZA[260] = ZA[257] + ZA[54]; + + ZA[276] = (ZCh(ZA[272], ZA[267], ZA[262]) + ZA[260]) + ZR26(ZA[272]); + ZA[274] = ZMa(ZA[268], ZA[263], ZA[273]) + ZR30(ZA[273]); + ZA[49] = ZA[48] + K[19]; + + ZA[61] = ZR15(ZA[52]) + ZA[35]; + ZA[278] = ZA[276] + ZA[274]; + ZA[277] = ZA[258] + ZA[276]; + ZA[265] = ZA[262] + ZA[49]; + + ZA[281] = (ZCh(ZA[277], ZA[272], ZA[267]) + ZA[265]) + ZR26(ZA[277]); + ZA[279] = ZMa(ZA[273], ZA[268], ZA[278]) + ZR30(ZA[278]); + ZA[62] = ZA[61] + K[20]; + + ZA[53] = ZR15(ZA[48]) + ZA[7]; + ZA[283] = ZA[281] + ZA[279]; + ZA[282] = ZA[263] + ZA[281]; + ZA[270] = ZA[267] + ZA[62]; + + ZA[286] = (ZCh(ZA[282], ZA[277], ZA[272]) + ZA[270]) + ZR26(ZA[282]); + ZA[284] = ZMa(ZA[278], ZA[273], ZA[283]) + ZR30(ZA[283]); + ZA[39] = ZA[38] + K[21]; + ZA[55] = ZA[53] + K[22]; + + ZA[66] = ZR15(ZA[61]) + ZA[39]; + ZA[288] = ZA[286] + ZA[284]; + ZA[287] = ZA[268] + ZA[286]; + ZA[275] = ZA[272] + ZA[55]; + + ZA[291] = (ZCh(ZA[287], ZA[282], ZA[277]) + ZA[275]) + ZR26(ZA[287]); + ZA[289] = ZMa(ZA[283], ZA[278], ZA[288]) + ZR30(ZA[288]); + ZA[12] = ZA[10] + W31; + ZA[68] = ZA[66] + K[23]; + + ZA[67] = ZR15(ZA[53]) + ZA[12]; + ZA[293] = ZA[291] + ZA[289]; + ZA[292] = ZA[273] + ZA[291]; + ZA[280] = ZA[277] + ZA[68]; + + ZA[296] = (ZCh(ZA[292], ZA[287], ZA[282]) + ZA[280]) + ZR26(ZA[292]); + ZA[294] = ZMa(ZA[288], ZA[283], ZA[293]) + ZR30(ZA[293]); + ZA[2] = ZR25(ZA[0]); + ZA[69] = ZA[67] + K[24]; + ZA[44] = ZA[43] + W32; + + ZA[75] = ZR15(ZA[66]) + ZA[44]; + ZA[298] = ZA[296] + ZA[294]; + ZA[297] = ZA[278] + ZA[296]; + ZA[285] = ZA[282] + ZA[69]; + ZA[5] = ZA[2] + W17; + + ZA[301] = (ZCh(ZA[297], ZA[292], ZA[287]) + ZA[285]) + ZR26(ZA[297]); + ZA[299] = ZMa(ZA[293], ZA[288], ZA[298]) + ZR30(ZA[298]); + ZA[56] = ZA[52] + ZA[5]; + ZA[76] = ZA[75] + K[25]; + + ZA[34] = ZR25(ZA[32]) + ZA[0]; + ZA[70] = ZR15(ZA[67]) + ZA[56]; + ZA[302] = ZA[283] + ZA[301]; + ZA[303] = ZA[301] + ZA[299]; + ZA[290] = ZA[287] + ZA[76]; + + ZA[306] = (ZCh(ZA[302], ZA[297], ZA[292]) + ZA[290]) + ZR26(ZA[302]); + ZA[304] = ZMa(ZA[298], ZA[293], ZA[303]) + ZR30(ZA[303]); + ZA[6] = ZR25(ZA[3]); + ZA[77] = ZA[70] + K[26]; + ZA[50] = ZA[34] + ZA[48]; + + ZA[78] = ZR15(ZA[75]) + ZA[50]; + ZA[308] = ZA[306] + ZA[304]; + ZA[307] = ZA[288] + ZA[306]; + ZA[295] = ZA[292] + ZA[77]; + ZA[41] = ZA[32] + ZA[6]; + + ZA[311] = (ZCh(ZA[307], ZA[302], ZA[297]) + ZA[295]) + ZR26(ZA[307]); + ZA[309] = ZMa(ZA[303], ZA[298], ZA[308]) + ZR30(ZA[308]); + ZA[63] = ZA[41] + ZA[61]; + ZA[85] = ZA[78] + K[27]; + + ZA[37] = ZR25(ZA[35]) + ZA[3]; + ZA[79] = ZR15(ZA[70]) + ZA[63]; + ZA[312] = ZA[293] + ZA[311]; + ZA[313] = ZA[311] + ZA[309]; + ZA[300] = ZA[297] + ZA[85]; + + ZA[316] = (ZCh(ZA[312], ZA[307], ZA[302]) + ZA[300]) + ZR26(ZA[312]); + ZA[314] = ZMa(ZA[308], ZA[303], ZA[313]) + ZR30(ZA[313]); + ZA[9] = ZR25(ZA[7]); + ZA[86] = ZA[79] + K[28]; + ZA[57] = ZA[37] + ZA[53]; + + ZA[87] = ZR15(ZA[78]) + ZA[57]; + ZA[318] = ZA[316] + ZA[314]; + ZA[317] = ZA[298] + ZA[316]; + ZA[305] = ZA[302] + ZA[86]; + ZA[46] = ZA[35] + ZA[9]; + + ZA[321] = (ZCh(ZA[317], ZA[312], ZA[307]) + ZA[305]) + ZR26(ZA[317]); + ZA[319] = ZMa(ZA[313], ZA[308], ZA[318]) + ZR30(ZA[318]); + ZA[71] = ZA[46] + ZA[66]; + ZA[92] = ZA[87] + K[29]; + + ZA[42] = ZR25(ZA[38]) + ZA[7]; + ZA[88] = ZR15(ZA[79]) + ZA[71]; + ZA[322] = ZA[303] + ZA[321]; + ZA[323] = ZA[321] + ZA[319]; + ZA[310] = ZA[307] + ZA[92]; + + ZA[326] = (ZCh(ZA[322], ZA[317], ZA[312]) + ZA[310]) + ZR26(ZA[322]); + ZA[324] = ZMa(ZA[318], ZA[313], ZA[323]) + ZR30(ZA[323]); + ZA[14] = ZR25(ZA[10]); + ZA[93] = ZA[88] + K[30]; + ZA[72] = ZA[42] + ZA[67]; + + ZA[94] = ZR15(ZA[87]) + ZA[72]; + ZA[328] = ZA[326] + ZA[324]; + ZA[327] = ZA[308] + ZA[326]; + ZA[315] = ZA[312] + ZA[93]; + ZA[51] = ZA[38] + ZA[14]; + + ZA[331] = (ZCh(ZA[327], ZA[322], ZA[317]) + ZA[315]) + ZR26(ZA[327]); + ZA[329] = ZMa(ZA[323], ZA[318], ZA[328]) + ZR30(ZA[328]); + ZA[80] = ZA[51] + ZA[75]; + ZA[100] = ZA[94] + K[31]; + + ZA[47] = ZR25(ZA[43]) + ZA[10]; + ZA[95] = ZR15(ZA[88]) + ZA[80]; + ZA[332] = ZA[313] + ZA[331]; + ZA[333] = ZA[331] + ZA[329]; + ZA[320] = ZA[317] + ZA[100]; + + ZA[336] = (ZCh(ZA[332], ZA[327], ZA[322]) + ZA[320]) + ZR26(ZA[332]); + ZA[334] = ZMa(ZA[328], ZA[323], ZA[333]) + ZR30(ZA[333]); + ZA[81] = ZA[47] + ZA[70]; + ZA[101] = ZA[95] + K[32]; + + ZA[58] = ZR25(ZA[52]) + ZA[43]; + ZA[102] = ZR15(ZA[94]) + ZA[81]; + ZA[337] = ZA[318] + ZA[336]; + ZA[338] = ZA[336] + ZA[334]; + ZA[325] = ZA[322] + ZA[101]; + + ZA[341] = (ZCh(ZA[337], ZA[332], ZA[327]) + ZA[325]) + ZR26(ZA[337]); + ZA[339] = ZMa(ZA[333], ZA[328], ZA[338]) + ZR30(ZA[338]); + ZA[89] = ZA[58] + ZA[78]; + ZA[108] = ZA[102] + K[33]; + + ZA[59] = ZR25(ZA[48]) + ZA[52]; + ZA[103] = ZR15(ZA[95]) + ZA[89]; + ZA[342] = ZA[323] + ZA[341]; + ZA[343] = ZA[341] + ZA[339]; + ZA[330] = ZA[327] + ZA[108]; + + ZA[346] = (ZCh(ZA[342], ZA[337], ZA[332]) + ZA[330]) + ZR26(ZA[342]); + ZA[344] = ZMa(ZA[338], ZA[333], ZA[343]) + ZR30(ZA[343]); + ZA[90] = ZA[59] + ZA[79]; + ZA[109] = ZA[103] + K[34]; + + ZA[64] = ZR25(ZA[61]) + ZA[48]; + ZA[110] = ZR15(ZA[102]) + ZA[90]; + ZA[347] = ZA[328] + ZA[346]; + ZA[348] = ZA[346] + ZA[344]; + ZA[335] = ZA[332] + ZA[109]; + + ZA[351] = (ZCh(ZA[347], ZA[342], ZA[337]) + ZA[335]) + ZR26(ZA[347]); + ZA[349] = ZMa(ZA[343], ZA[338], ZA[348]) + ZR30(ZA[348]); + ZA[60] = ZR25(ZA[53]); + ZA[116] = ZA[110] + K[35]; + ZA[96] = ZA[87] + ZA[64]; + + ZA[111] = ZR15(ZA[103]) + ZA[96]; + ZA[353] = ZA[351] + ZA[349]; + ZA[352] = ZA[333] + ZA[351]; + ZA[340] = ZA[337] + ZA[116]; + ZA[65] = ZA[60] + ZA[61]; + + ZA[356] = (ZCh(ZA[352], ZA[347], ZA[342]) + ZA[340]) + ZR26(ZA[352]); + ZA[354] = ZMa(ZA[348], ZA[343], ZA[353]) + ZR30(ZA[353]); + ZA[97] = ZA[88] + ZA[65]; + ZA[117] = ZA[111] + K[36]; + + ZA[73] = ZR25(ZA[66]) + ZA[53]; + ZA[118] = ZR15(ZA[110]) + ZA[97]; + ZA[357] = ZA[338] + ZA[356]; + ZA[358] = ZA[356] + ZA[354]; + ZA[345] = ZA[342] + ZA[117]; + + ZA[361] = (ZCh(ZA[357], ZA[352], ZA[347]) + ZA[345]) + ZR26(ZA[357]); + ZA[359] = ZMa(ZA[353], ZA[348], ZA[358]) + ZR30(ZA[358]); + ZA[104] = ZA[73] + ZA[94]; + ZA[124] = ZA[118] + K[37]; + + ZA[74] = ZR25(ZA[67]) + ZA[66]; + ZA[119] = ZR15(ZA[111]) + ZA[104]; + ZA[362] = ZA[343] + ZA[361]; + ZA[363] = ZA[361] + ZA[359]; + ZA[350] = ZA[347] + ZA[124]; + + ZA[366] = (ZCh(ZA[362], ZA[357], ZA[352]) + ZA[350]) + ZR26(ZA[362]); + ZA[364] = ZMa(ZA[358], ZA[353], ZA[363]) + ZR30(ZA[363]); + ZA[105] = ZA[74] + ZA[95]; + ZA[125] = ZA[119] + K[38]; + + ZA[82] = ZR25(ZA[75]) + ZA[67]; + ZA[126] = ZR15(ZA[118]) + ZA[105]; + ZA[367] = ZA[348] + ZA[366]; + ZA[368] = ZA[366] + ZA[364]; + ZA[355] = ZA[352] + ZA[125]; + + ZA[371] = (ZCh(ZA[367], ZA[362], ZA[357]) + ZA[355]) + ZR26(ZA[367]); + ZA[369] = ZMa(ZA[363], ZA[358], ZA[368]) + ZR30(ZA[368]); + ZA[112] = ZA[102] + ZA[82]; + ZA[132] = ZA[126] + K[39]; + + ZA[83] = ZR25(ZA[70]) + ZA[75]; + ZA[127] = ZR15(ZA[119]) + ZA[112]; + ZA[372] = ZA[353] + ZA[371]; + ZA[373] = ZA[371] + ZA[369]; + ZA[360] = ZA[357] + ZA[132]; + + ZA[376] = (ZCh(ZA[372], ZA[367], ZA[362]) + ZA[360]) + ZR26(ZA[372]); + ZA[374] = ZMa(ZA[368], ZA[363], ZA[373]) + ZR30(ZA[373]); + ZA[113] = ZA[103] + ZA[83]; + ZA[133] = ZA[127] + K[40]; + + ZA[84] = ZR25(ZA[78]) + ZA[70]; + ZA[134] = ZR15(ZA[126]) + ZA[113]; + ZA[377] = ZA[358] + ZA[376]; + ZA[378] = ZA[376] + ZA[374]; + ZA[365] = ZA[362] + ZA[133]; + + ZA[381] = (ZCh(ZA[377], ZA[372], ZA[367]) + ZA[365]) + ZR26(ZA[377]); + ZA[379] = ZMa(ZA[373], ZA[368], ZA[378]) + ZR30(ZA[378]); + ZA[120] = ZA[110] + ZA[84]; + ZA[140] = ZA[134] + K[41]; + + ZA[91] = ZR25(ZA[79]) + ZA[78]; + ZA[135] = ZR15(ZA[127]) + ZA[120]; + ZA[382] = ZA[363] + ZA[381]; + ZA[383] = ZA[381] + ZA[379]; + ZA[370] = ZA[367] + ZA[140]; + + ZA[386] = (ZCh(ZA[382], ZA[377], ZA[372]) + ZA[370]) + ZR26(ZA[382]); + ZA[384] = ZMa(ZA[378], ZA[373], ZA[383]) + ZR30(ZA[383]); + ZA[121] = ZA[111] + ZA[91]; + ZA[141] = ZA[135] + K[42]; + + ZA[98] = ZR25(ZA[87]) + ZA[79]; + ZA[142] = ZR15(ZA[134]) + ZA[121]; + ZA[387] = ZA[368] + ZA[386]; + ZA[388] = ZA[386] + ZA[384]; + ZA[375] = ZA[372] + ZA[141]; + + ZA[391] = (ZCh(ZA[387], ZA[382], ZA[377]) + ZA[375]) + ZR26(ZA[387]); + ZA[389] = ZMa(ZA[383], ZA[378], ZA[388]) + ZR30(ZA[388]); + ZA[128] = ZA[118] + ZA[98]; + ZA[147] = ZA[142] + K[43]; + + ZA[99] = ZR25(ZA[88]) + ZA[87]; + ZA[143] = ZR15(ZA[135]) + ZA[128]; + ZA[392] = ZA[373] + ZA[391]; + ZA[393] = ZA[391] + ZA[389]; + ZA[380] = ZA[377] + ZA[147]; + + ZA[396] = (ZCh(ZA[392], ZA[387], ZA[382]) + ZA[380]) + ZR26(ZA[392]); + ZA[394] = ZMa(ZA[388], ZA[383], ZA[393]) + ZR30(ZA[393]); + ZA[129] = ZA[119] + ZA[99]; + ZA[148] = ZA[143] + K[44]; + + ZA[106] = ZR25(ZA[94]) + ZA[88]; + ZA[149] = ZR15(ZA[142]) + ZA[129]; + ZA[397] = ZA[378] + ZA[396]; + ZA[398] = ZA[396] + ZA[394]; + ZA[385] = ZA[382] + ZA[148]; + + ZA[401] = (ZCh(ZA[397], ZA[392], ZA[387]) + ZA[385]) + ZR26(ZA[397]); + ZA[399] = ZMa(ZA[393], ZA[388], ZA[398]) + ZR30(ZA[398]); + ZA[136] = ZA[126] + ZA[106]; + ZA[153] = ZA[149] + K[45]; + + ZA[107] = ZR25(ZA[95]) + ZA[94]; + ZA[150] = ZR15(ZA[143]) + ZA[136]; + ZA[402] = ZA[383] + ZA[401]; + ZA[403] = ZA[401] + ZA[399]; + ZA[390] = ZA[387] + ZA[153]; + + ZA[406] = (ZCh(ZA[402], ZA[397], ZA[392]) + ZA[390]) + ZR26(ZA[402]); + ZA[404] = ZMa(ZA[398], ZA[393], ZA[403]) + ZR30(ZA[403]); + ZA[137] = ZA[127] + ZA[107]; + ZA[154] = ZA[150] + K[46]; + + ZA[114] = ZR25(ZA[102]) + ZA[95]; + ZA[155] = ZR15(ZA[149]) + ZA[137]; + ZA[407] = ZA[388] + ZA[406]; + ZA[408] = ZA[406] + ZA[404]; + ZA[395] = ZA[392] + ZA[154]; + + ZA[411] = (ZCh(ZA[407], ZA[402], ZA[397]) + ZA[395]) + ZR26(ZA[407]); + ZA[409] = ZMa(ZA[403], ZA[398], ZA[408]) + ZR30(ZA[408]); + ZA[144] = ZA[134] + ZA[114]; + ZA[159] = ZA[155] + K[47]; + + ZA[115] = ZR25(ZA[103]) + ZA[102]; + ZA[156] = ZR15(ZA[150]) + ZA[144]; + ZA[412] = ZA[393] + ZA[411]; + ZA[413] = ZA[411] + ZA[409]; + ZA[400] = ZA[397] + ZA[159]; + + ZA[416] = (ZCh(ZA[412], ZA[407], ZA[402]) + ZA[400]) + ZR26(ZA[412]); + ZA[414] = ZMa(ZA[408], ZA[403], ZA[413]) + ZR30(ZA[413]); + ZA[145] = ZA[135] + ZA[115]; + ZA[160] = ZA[156] + K[48]; + + ZA[122] = ZR25(ZA[110]) + ZA[103]; + ZA[161] = ZR15(ZA[155]) + ZA[145]; + ZA[417] = ZA[398] + ZA[416]; + ZA[418] = ZA[416] + ZA[414]; + ZA[405] = ZA[402] + ZA[160]; + + ZA[421] = (ZCh(ZA[417], ZA[412], ZA[407]) + ZA[405]) + ZR26(ZA[417]); + ZA[419] = ZMa(ZA[413], ZA[408], ZA[418]) + ZR30(ZA[418]); + ZA[151] = ZA[142] + ZA[122]; + ZA[165] = ZA[161] + K[49]; + + ZA[123] = ZR25(ZA[111]) + ZA[110]; + ZA[162] = ZR15(ZA[156]) + ZA[151]; + ZA[422] = ZA[403] + ZA[421]; + ZA[423] = ZA[421] + ZA[419]; + ZA[410] = ZA[407] + ZA[165]; + + ZA[426] = (ZCh(ZA[422], ZA[417], ZA[412]) + ZA[410]) + ZR26(ZA[422]); + ZA[424] = ZMa(ZA[418], ZA[413], ZA[423]) + ZR30(ZA[423]); + ZA[152] = ZA[143] + ZA[123]; + ZA[166] = ZA[162] + K[50]; + + ZA[130] = ZR25(ZA[118]) + ZA[111]; + ZA[167] = ZR15(ZA[161]) + ZA[152]; + ZA[427] = ZA[408] + ZA[426]; + ZA[428] = ZA[426] + ZA[424]; + ZA[415] = ZA[412] + ZA[166]; + + ZA[431] = (ZCh(ZA[427], ZA[422], ZA[417]) + ZA[415]) + ZR26(ZA[427]); + ZA[429] = ZMa(ZA[423], ZA[418], ZA[428]) + ZR30(ZA[428]); + ZA[157] = ZA[149] + ZA[130]; + ZA[170] = ZA[167] + K[51]; + + ZA[131] = ZR25(ZA[119]) + ZA[118]; + ZA[168] = ZR15(ZA[162]) + ZA[157]; + ZA[432] = ZA[413] + ZA[431]; + ZA[433] = ZA[431] + ZA[429]; + ZA[420] = ZA[417] + ZA[170]; + + ZA[436] = (ZCh(ZA[432], ZA[427], ZA[422]) + ZA[420]) + ZR26(ZA[432]); + ZA[434] = ZMa(ZA[428], ZA[423], ZA[433]) + ZR30(ZA[433]); + ZA[158] = ZA[150] + ZA[131]; + ZA[171] = ZA[168] + K[52]; + + ZA[138] = ZR25(ZA[126]) + ZA[119]; + ZA[172] = ZR15(ZA[167]) + ZA[158]; + ZA[437] = ZA[418] + ZA[436]; + ZA[438] = ZA[436] + ZA[434]; + ZA[425] = ZA[422] + ZA[171]; + + ZA[441] = (ZCh(ZA[437], ZA[432], ZA[427]) + ZA[425]) + ZR26(ZA[437]); + ZA[439] = ZMa(ZA[433], ZA[428], ZA[438]) + ZR30(ZA[438]); + ZA[163] = ZA[155] + ZA[138]; + ZA[174] = ZA[172] + K[53]; + + ZA[139] = ZR25(ZA[127]) + ZA[126]; + ZA[173] = ZR15(ZA[168]) + ZA[163]; + ZA[442] = ZA[423] + ZA[441]; + ZA[443] = ZA[441] + ZA[439]; + ZA[430] = ZA[427] + ZA[174]; + + ZA[445] = (ZCh(ZA[442], ZA[437], ZA[432]) + ZA[430]) + ZR26(ZA[442]); + ZA[444] = ZMa(ZA[438], ZA[433], ZA[443]) + ZR30(ZA[443]); + ZA[164] = ZA[156] + ZA[139]; + ZA[175] = ZA[173] + K[54]; + + ZA[146] = ZR25(ZA[134]) + ZA[127]; + ZA[176] = ZR15(ZA[172]) + ZA[164]; + ZA[446] = ZA[428] + ZA[445]; + ZA[447] = ZA[445] + ZA[444]; + ZA[435] = ZA[432] + ZA[175]; + + ZA[449] = (ZCh(ZA[446], ZA[442], ZA[437]) + ZA[435]) + ZR26(ZA[446]); + ZA[448] = ZMa(ZA[443], ZA[438], ZA[447]) + ZR30(ZA[447]); + ZA[169] = ZA[161] + ZA[146]; + ZA[178] = ZA[176] + K[55]; + + ZA[177] = ZR15(ZA[173]) + ZA[169]; + ZA[451] = ZA[449] + ZA[448]; + ZA[450] = ZA[433] + ZA[449]; + ZA[440] = ZA[437] + ZA[178]; + + ZA[453] = (ZCh(ZA[450], ZA[446], ZA[442]) + ZA[440]) + ZR26(ZA[450]); + ZA[452] = ZMa(ZA[447], ZA[443], ZA[451]) + ZR30(ZA[451]); + ZA[179] = ZA[177] + K[56]; + + ZA[454] = ZA[438] + ZA[453]; + ZA[494] = ZA[442] + ZA[179]; + ZA[455] = ZA[453] + ZA[452]; + + ZA[457] = (ZCh(ZA[454], ZA[450], ZA[446]) + ZA[494]) + ZR26(ZA[454]); + ZA[456] = ZMa(ZA[451], ZA[447], ZA[455]) + ZR30(ZA[455]); + + ZA[459] = ZA[457] + ZA[456]; + + ZA[461] = ZA[455] + state1; + ZA[460] = ZA[459] + state0; + + ZA[495] = ZA[460] + K[57]; + ZA[469] = ZA[461] + K[58]; + + ZA[498] = (ZCh(ZA[495], K[59], K[60]) + ZA[469]) + ZR26(ZA[495]); + ZA[462] = ZA[451] + state2; + + ZA[496] = ZA[460] + K[61]; + ZA[506] = ZA[498] + K[62]; + ZA[470] = ZA[462] + K[63]; + + ZA[507] = (ZCh(ZA[506], ZA[495], K[59]) + ZA[470]) + ZR26(ZA[506]); + ZA[500] = ZMa(K[64], K[65], ZA[496]) + ZR30(ZA[496]); + ZA[463] = ZA[447] + state3; + + ZA[458] = ZA[443] + ZA[457]; + ZA[499] = ZA[498] + ZA[500]; + ZA[508] = ZA[507] + K[65]; + ZA[473] = ZA[463] + K[66]; + + ZA[510] = (ZCh(ZA[508], ZA[506], ZA[495]) + ZA[473]) + ZR26(ZA[508]); + ZA[928] = ZMa(ZA[496], K[64], ZA[499]) + ZR30(ZA[499]); + ZA[464] = ZA[458] + state4; + + ZA[476] = ZA[464] + ZA[460] + K[67]; + ZA[511] = ZA[510] + K[64]; + ZA[509] = ZA[928] + ZA[507]; + ZA[465] = ZA[454] + state5; + + ZA[514] = (ZCh(ZA[511], ZA[508], ZA[506]) + ZA[476]) + ZR26(ZA[511]); + ZA[512] = ZMa(ZA[499], ZA[496], ZA[509]) + ZR30(ZA[509]); + ZA[478] = ZA[465] + K[68]; + + ZA[519] = ZA[506] + ZA[478]; + ZA[516] = ZA[496] + ZA[514]; + ZA[513] = ZA[510] + ZA[512]; + ZA[466] = ZA[450] + state6; + + ZA[520] = (ZCh(ZA[516], ZA[511], ZA[508]) + ZA[519]) + ZR26(ZA[516]); + ZA[515] = ZMa(ZA[509], ZA[499], ZA[513]) + ZR30(ZA[513]); + ZA[480] = ZA[466] + K[69]; + + ZA[524] = ZA[508] + ZA[480]; + ZA[521] = ZA[499] + ZA[520]; + ZA[517] = ZA[514] + ZA[515]; + ZA[467] = ZA[446] + state7; + + ZA[525] = (ZCh(ZA[521], ZA[516], ZA[511]) + ZA[524]) + ZR26(ZA[521]); + ZA[522] = ZMa(ZA[513], ZA[509], ZA[517]) + ZR30(ZA[517]); + ZA[484] = ZA[467] + K[70]; + + ZA[529] = ZA[511] + ZA[484]; + ZA[526] = ZA[509] + ZA[525]; + ZA[523] = ZA[520] + ZA[522]; + + ZA[530] = (ZCh(ZA[526], ZA[521], ZA[516]) + ZA[529]) + ZR26(ZA[526]); + ZA[550] = ZMa(ZA[517], ZA[513], ZA[523]) + ZR30(ZA[523]); + + ZA[531] = ZA[513] + ZA[530]; + ZA[533] = ZA[516] + K[71]; + ZA[527] = ZA[550] + ZA[525]; + + ZA[534] = (ZCh(ZA[531], ZA[526], ZA[521]) + ZA[533]) + ZR26(ZA[531]); + ZA[551] = ZMa(ZA[523], ZA[517], ZA[527]) + ZR30(ZA[527]); + + ZA[535] = ZA[517] + ZA[534]; + ZA[538] = ZA[521] + K[1]; + ZA[532] = ZA[551] + ZA[530]; + + ZA[539] = (ZCh(ZA[535], ZA[531], ZA[526]) + ZA[538]) + ZR26(ZA[535]); + ZA[552] = ZMa(ZA[527], ZA[523], ZA[532]) + ZR30(ZA[532]); + + ZA[540] = ZA[523] + ZA[539]; + ZA[542] = ZA[526] + K[2]; + ZA[536] = ZA[552] + ZA[534]; + + ZA[543] = (ZCh(ZA[540], ZA[535], ZA[531]) + ZA[542]) + ZR26(ZA[540]); + ZA[553] = ZMa(ZA[532], ZA[527], ZA[536]) + ZR30(ZA[536]); + + ZA[544] = ZA[527] + ZA[543]; + ZA[555] = ZA[531] + K[3]; + ZA[541] = ZA[553] + ZA[539]; + + ZA[558] = (ZCh(ZA[544], ZA[540], ZA[535]) + ZA[555]) + ZR26(ZA[544]); + ZA[547] = ZMa(ZA[536], ZA[532], ZA[541]) + ZR30(ZA[541]); + + ZA[559] = ZA[532] + ZA[558]; + ZA[556] = ZA[535] + K[4]; + ZA[545] = ZA[547] + ZA[543]; + + ZA[562] = (ZCh(ZA[559], ZA[544], ZA[540]) + ZA[556]) + ZR26(ZA[559]); + ZA[561] = ZMa(ZA[541], ZA[536], ZA[545]) + ZR30(ZA[545]); + + ZA[563] = ZA[536] + ZA[562]; + ZA[560] = ZA[561] + ZA[558]; + ZA[557] = ZA[540] + K[5]; + + ZA[568] = (ZCh(ZA[563], ZA[559], ZA[544]) + ZA[557]) + ZR26(ZA[563]); + ZA[564] = ZMa(ZA[545], ZA[541], ZA[560]) + ZR30(ZA[560]); + + ZA[569] = ZA[541] + ZA[568]; + ZA[572] = ZA[544] + K[6]; + ZA[565] = ZA[562] + ZA[564]; + + ZA[574] = (ZCh(ZA[569], ZA[563], ZA[559]) + ZA[572]) + ZR26(ZA[569]); + ZA[570] = ZMa(ZA[560], ZA[545], ZA[565]) + ZR30(ZA[565]); + ZA[468] = ZR25(ZA[461]); + + ZA[497] = ZA[468] + ZA[460]; + ZA[575] = ZA[545] + ZA[574]; + ZA[571] = ZA[568] + ZA[570]; + ZA[573] = ZA[559] + K[72]; + + ZA[578] = (ZCh(ZA[575], ZA[569], ZA[563]) + ZA[573]) + ZR26(ZA[575]); + ZA[576] = ZMa(ZA[565], ZA[560], ZA[571]) + ZR30(ZA[571]); + ZA[929] = ZR25(ZA[462]); + ZA[503] = ZA[497] + 0xe49b69c1U; + + ZA[471] = ZA[929] + ZA[461] + K[74]; + ZA[582] = ZA[563] + ZA[503]; + ZA[579] = ZA[560] + ZA[578]; + ZA[577] = ZA[574] + ZA[576]; + + ZA[583] = (ZCh(ZA[579], ZA[575], ZA[569]) + ZA[582]) + ZR26(ZA[579]); + ZA[580] = ZMa(ZA[571], ZA[565], ZA[577]) + ZR30(ZA[577]); + ZA[488] = ZA[471] + K[75]; + + ZA[472] = ZR25(ZA[463]) + ZA[462]; + ZA[587] = ZA[569] + ZA[488]; + ZA[584] = ZA[565] + ZA[583]; + ZA[581] = ZA[578] + ZA[580]; + + ZA[588] = (ZCh(ZA[584], ZA[579], ZA[575]) + ZA[587]) + ZR26(ZA[584]); + ZA[586] = ZMa(ZA[577], ZA[571], ZA[581]) + ZR30(ZA[581]); + ZA[501] = ZR15(ZA[497]) + ZA[472]; + ZA[475] = ZR15(ZA[471]); + ZA[926] = ZA[575] + K[8]; + + ZA[474] = ZA[475] + ZA[463] + ZR25(ZA[464]); + ZA[927] = ZA[926] + ZA[501]; + ZA[589] = ZA[571] + ZA[588]; + ZA[585] = ZA[583] + ZA[586]; + + ZA[592] = (ZCh(ZA[589], ZA[584], ZA[579]) + ZA[927]) + ZR26(ZA[589]); + ZA[590] = ZMa(ZA[581], ZA[577], ZA[585]) + ZR30(ZA[585]); + ZA[477] = ZR25(ZA[465]) + ZA[464]; + ZA[489] = ZA[474] + K[9]; + + ZA[518] = ZR15(ZA[501]) + ZA[477]; + ZA[479] = ZR25(ZA[466]); + ZA[596] = ZA[579] + ZA[489]; + ZA[593] = ZA[577] + ZA[592]; + ZA[591] = ZA[588] + ZA[590]; + + ZA[597] = (ZCh(ZA[593], ZA[589], ZA[584]) + ZA[596]) + ZR26(ZA[593]); + ZA[594] = ZMa(ZA[585], ZA[581], ZA[591]) + ZR30(ZA[591]); + ZA[481] = ZA[479] + ZA[465]; + ZA[601] = ZA[518] + K[11]; + + ZA[482] = ZR15(ZA[474]) + ZA[481]; + ZA[602] = ZA[584] + ZA[601]; + ZA[598] = ZA[581] + ZA[597]; + ZA[595] = ZA[592] + ZA[594]; + + ZA[632] = (ZCh(ZA[598], ZA[593], ZA[589]) + ZA[602]) + ZR26(ZA[598]); + ZA[599] = ZMa(ZA[591], ZA[585], ZA[595]) + ZR30(ZA[595]); + ZA[483] = ZA[466] + K[76] + ZR25(ZA[467]); + ZA[490] = ZA[482] + K[12]; + + ZA[528] = ZR15(ZA[518]) + ZA[483]; + ZA[736] = ZA[585] + ZA[632]; + ZA[605] = ZA[589] + ZA[490]; + ZA[600] = ZA[597] + ZA[599]; + ZA[485] = ZA[467] + K[77]; + + ZA[738] = (ZCh(ZA[736], ZA[598], ZA[593]) + ZA[605]) + ZR26(ZA[736]); + ZA[744] = ZMa(ZA[595], ZA[591], ZA[600]) + ZR30(ZA[600]); + ZA[487] = ZR15(ZA[482]) + ZA[485]; + ZA[603] = ZA[528] + K[14]; + + ZA[502] = ZA[497] + ZA[487]; + ZA[739] = ZA[591] + ZA[738]; + ZA[604] = ZA[593] + ZA[603]; + ZA[737] = ZA[744] + ZA[632]; + + ZA[741] = (ZCh(ZA[739], ZA[736], ZA[598]) + ZA[604]) + ZR26(ZA[739]); + ZA[745] = ZMa(ZA[600], ZA[595], ZA[737]) + ZR30(ZA[737]); + ZA[486] = ZA[471] + K[10]; + ZA[606] = ZA[502] + K[15]; + + ZA[537] = ZR15(ZA[528]) + ZA[486]; + ZA[742] = ZA[595] + ZA[741]; + ZA[613] = ZA[598] + ZA[606]; + ZA[740] = ZA[745] + ZA[738]; + + ZA[747] = (ZCh(ZA[742], ZA[739], ZA[736]) + ZA[613]) + ZR26(ZA[742]); + ZA[746] = ZMa(ZA[737], ZA[600], ZA[740]) + ZR30(ZA[740]); + ZA[607] = ZA[537] + K[16]; + + ZA[546] = ZR15(ZA[502]) + ZA[501]; + ZA[751] = ZA[736] + ZA[607]; + ZA[748] = ZA[600] + ZA[747]; + ZA[743] = ZA[746] + ZA[741]; + + ZA[752] = (ZCh(ZA[748], ZA[742], ZA[739]) + ZA[751]) + ZR26(ZA[748]); + ZA[749] = ZMa(ZA[740], ZA[737], ZA[743]) + ZR30(ZA[743]); + ZA[608] = ZA[546] + K[17]; + + ZA[554] = ZR15(ZA[537]) + ZA[474]; + ZA[756] = ZA[739] + ZA[608]; + ZA[753] = ZA[737] + ZA[752]; + ZA[750] = ZA[747] + ZA[749]; + + ZA[757] = (ZCh(ZA[753], ZA[748], ZA[742]) + ZA[756]) + ZR26(ZA[753]); + ZA[754] = ZMa(ZA[743], ZA[740], ZA[750]) + ZR30(ZA[750]); + ZA[609] = ZA[554] + K[18]; + + ZA[566] = ZR15(ZA[546]) + ZA[518]; + ZA[761] = ZA[742] + ZA[609]; + ZA[758] = ZA[740] + ZA[757]; + ZA[755] = ZA[752] + ZA[754]; + + ZA[762] = (ZCh(ZA[758], ZA[753], ZA[748]) + ZA[761]) + ZR26(ZA[758]); + ZA[759] = ZMa(ZA[750], ZA[743], ZA[755]) + ZR30(ZA[755]); + ZA[610] = ZA[566] + K[19]; + + ZA[567] = ZR15(ZA[554]) + ZA[482]; + ZA[766] = ZA[748] + ZA[610]; + ZA[763] = ZA[743] + ZA[762]; + ZA[760] = ZA[757] + ZA[759]; + + ZA[767] = (ZCh(ZA[763], ZA[758], ZA[753]) + ZA[766]) + ZR26(ZA[763]); + ZA[764] = ZMa(ZA[755], ZA[750], ZA[760]) + ZR30(ZA[760]); + ZA[611] = ZA[567] + K[20]; + + ZA[614] = ZR15(ZA[566]) + ZA[528]; + ZA[771] = ZA[753] + ZA[611]; + ZA[768] = ZA[750] + ZA[767]; + ZA[765] = ZA[762] + ZA[764]; + + ZA[772] = (ZCh(ZA[768], ZA[763], ZA[758]) + ZA[771]) + ZR26(ZA[768]); + ZA[769] = ZMa(ZA[760], ZA[755], ZA[765]) + ZR30(ZA[765]); + ZA[612] = ZA[502] + K[78]; + ZA[615] = ZA[614] + K[22]; + + ZA[616] = ZR15(ZA[567]) + ZA[612]; + ZA[504] = ZR25(ZA[497]) + K[76]; + ZA[776] = ZA[758] + ZA[615]; + ZA[773] = ZA[755] + ZA[772]; + ZA[770] = ZA[767] + ZA[769]; + + ZA[777] = (ZCh(ZA[773], ZA[768], ZA[763]) + ZA[776]) + ZR26(ZA[773]); + ZA[774] = ZMa(ZA[765], ZA[760], ZA[770]) + ZR30(ZA[770]); + ZA[492] = ZR25(ZA[471]); + ZA[618] = ZA[537] + ZA[504]; + ZA[617] = ZA[616] + K[23]; + + ZA[619] = ZR15(ZA[614]) + ZA[618]; + ZA[781] = ZA[763] + ZA[617]; + ZA[778] = ZA[760] + ZA[777]; + ZA[775] = ZA[772] + ZA[774]; + ZA[505] = ZA[492] + ZA[497]; + + ZA[782] = (ZCh(ZA[778], ZA[773], ZA[768]) + ZA[781]) + ZR26(ZA[778]); + ZA[779] = ZMa(ZA[770], ZA[765], ZA[775]) + ZR30(ZA[775]); + ZA[621] = ZA[505] + ZA[546]; + ZA[620] = ZA[619] + K[24]; + + ZA[622] = ZR15(ZA[616]) + ZA[621]; + ZA[625] = ZR25(ZA[501]); + ZA[786] = ZA[768] + ZA[620]; + ZA[783] = ZA[765] + ZA[782]; + ZA[624] = ZA[554] + ZA[471]; + ZA[780] = ZA[777] + ZA[779]; + + ZA[787] = (ZCh(ZA[783], ZA[778], ZA[773]) + ZA[786]) + ZR26(ZA[783]); + ZA[784] = ZMa(ZA[775], ZA[770], ZA[780]) + ZR30(ZA[780]); + ZA[493] = ZR25(ZA[474]); + ZA[626] = ZA[625] + ZA[624]; + ZA[623] = ZA[622] + K[25]; + + ZA[627] = ZR15(ZA[619]) + ZA[626]; + ZA[791] = ZA[773] + ZA[623]; + ZA[788] = ZA[770] + ZA[787]; + ZA[785] = ZA[782] + ZA[784]; + ZA[629] = ZA[493] + ZA[501]; + + ZA[792] = (ZCh(ZA[788], ZA[783], ZA[778]) + ZA[791]) + ZR26(ZA[788]); + ZA[789] = ZMa(ZA[780], ZA[775], ZA[785]) + ZR30(ZA[785]); + ZA[630] = ZA[566] + ZA[629]; + ZA[628] = ZA[627] + K[26]; + + ZA[634] = ZR25(ZA[518]) + ZA[474]; + ZA[631] = ZR15(ZA[622]) + ZA[630]; + ZA[796] = ZA[778] + ZA[628]; + ZA[793] = ZA[775] + ZA[792]; + ZA[790] = ZA[787] + ZA[789]; + + ZA[797] = (ZCh(ZA[793], ZA[788], ZA[783]) + ZA[796]) + ZR26(ZA[793]); + ZA[794] = ZMa(ZA[785], ZA[780], ZA[790]) + ZR30(ZA[790]); + ZA[491] = ZR25(ZA[482]); + ZA[635] = ZA[567] + ZA[634]; + ZA[633] = ZA[631] + K[27]; + + ZA[636] = ZR15(ZA[627]) + ZA[635]; + ZA[801] = ZA[783] + ZA[633]; + ZA[798] = ZA[780] + ZA[797]; + ZA[795] = ZA[792] + ZA[794]; + ZA[638] = ZA[491] + ZA[518]; + + ZA[802] = (ZCh(ZA[798], ZA[793], ZA[788]) + ZA[801]) + ZR26(ZA[798]); + ZA[799] = ZMa(ZA[790], ZA[785], ZA[795]) + ZR30(ZA[795]); + ZA[639] = ZA[638] + ZA[614]; + ZA[637] = ZA[636] + K[28]; + + ZA[642] = ZR25(ZA[528]) + ZA[482]; + ZA[640] = ZR15(ZA[631]) + ZA[639]; + ZA[806] = ZA[788] + ZA[637]; + ZA[803] = ZA[785] + ZA[802]; + ZA[800] = ZA[797] + ZA[799]; + + ZA[807] = (ZCh(ZA[803], ZA[798], ZA[793]) + ZA[806]) + ZR26(ZA[803]); + ZA[804] = ZMa(ZA[795], ZA[790], ZA[800]) + ZR30(ZA[800]); + ZA[643] = ZA[616] + ZA[642]; + ZA[641] = ZA[640] + K[29]; + + ZA[646] = ZR25(ZA[502]) + ZA[528]; + ZA[644] = ZR15(ZA[636]) + ZA[643]; + ZA[811] = ZA[793] + ZA[641]; + ZA[808] = ZA[790] + ZA[807]; + ZA[805] = ZA[802] + ZA[804]; + + ZA[812] = (ZCh(ZA[808], ZA[803], ZA[798]) + ZA[811]) + ZR26(ZA[808]); + ZA[809] = ZMa(ZA[800], ZA[795], ZA[805]) + ZR30(ZA[805]); + ZA[647] = ZA[619] + ZA[646]; + ZA[645] = ZA[644] + K[30]; + + ZA[650] = ZR25(ZA[537]) + ZA[502]; + ZA[648] = ZR15(ZA[640]) + ZA[647]; + ZA[816] = ZA[798] + ZA[645]; + ZA[813] = ZA[795] + ZA[812]; + ZA[810] = ZA[807] + ZA[809]; + + ZA[817] = (ZCh(ZA[813], ZA[808], ZA[803]) + ZA[816]) + ZR26(ZA[813]); + ZA[814] = ZMa(ZA[805], ZA[800], ZA[810]) + ZR30(ZA[810]); + ZA[925] = ZA[622] + ZA[650]; + ZA[649] = ZA[648] + K[31]; + + ZA[653] = ZR25(ZA[546]) + ZA[537]; + ZA[651] = ZR15(ZA[644]) + ZA[925]; + ZA[821] = ZA[803] + ZA[649]; + ZA[818] = ZA[800] + ZA[817]; + ZA[815] = ZA[812] + ZA[814]; + + ZA[822] = (ZCh(ZA[818], ZA[813], ZA[808]) + ZA[821]) + ZR26(ZA[818]); + ZA[819] = ZMa(ZA[810], ZA[805], ZA[815]) + ZR30(ZA[815]); + ZA[654] = ZA[627] + ZA[653]; + ZA[652] = ZA[651] + K[32]; + + ZA[657] = ZR25(ZA[554]) + ZA[546]; + ZA[655] = ZR15(ZA[648]) + ZA[654]; + ZA[826] = ZA[808] + ZA[652]; + ZA[823] = ZA[805] + ZA[822]; + ZA[820] = ZA[817] + ZA[819]; + + ZA[827] = (ZCh(ZA[823], ZA[818], ZA[813]) + ZA[826]) + ZR26(ZA[823]); + ZA[824] = ZMa(ZA[815], ZA[810], ZA[820]) + ZR30(ZA[820]); + ZA[658] = ZA[631] + ZA[657]; + ZA[656] = ZA[655] + K[33]; + + ZA[661] = ZR25(ZA[566]) + ZA[554]; + ZA[659] = ZR15(ZA[651]) + ZA[658]; + ZA[831] = ZA[813] + ZA[656]; + ZA[828] = ZA[810] + ZA[827]; + ZA[825] = ZA[822] + ZA[824]; + + ZA[832] = (ZCh(ZA[828], ZA[823], ZA[818]) + ZA[831]) + ZR26(ZA[828]); + ZA[829] = ZMa(ZA[820], ZA[815], ZA[825]) + ZR30(ZA[825]); + ZA[662] = ZA[636] + ZA[661]; + ZA[660] = ZA[659] + K[34]; + + ZA[665] = ZR25(ZA[567]) + ZA[566]; + ZA[663] = ZR15(ZA[655]) + ZA[662]; + ZA[836] = ZA[818] + ZA[660]; + ZA[833] = ZA[815] + ZA[832]; + ZA[830] = ZA[827] + ZA[829]; + + ZA[837] = (ZCh(ZA[833], ZA[828], ZA[823]) + ZA[836]) + ZR26(ZA[833]); + ZA[834] = ZMa(ZA[825], ZA[820], ZA[830]) + ZR30(ZA[830]); + ZA[666] = ZA[640] + ZA[665]; + ZA[664] = ZA[663] + K[35]; + + ZA[669] = ZR25(ZA[614]) + ZA[567]; + ZA[667] = ZR15(ZA[659]) + ZA[666]; + ZA[841] = ZA[823] + ZA[664]; + ZA[838] = ZA[820] + ZA[837]; + ZA[835] = ZA[832] + ZA[834]; + + ZA[842] = (ZCh(ZA[838], ZA[833], ZA[828]) + ZA[841]) + ZR26(ZA[838]); + ZA[839] = ZMa(ZA[830], ZA[825], ZA[835]) + ZR30(ZA[835]); + ZA[670] = ZA[644] + ZA[669]; + ZA[668] = ZA[667] + K[36]; + + ZA[677] = ZR25(ZA[616]) + ZA[614]; + ZA[671] = ZR15(ZA[663]) + ZA[670]; + ZA[846] = ZA[828] + ZA[668]; + ZA[843] = ZA[825] + ZA[842]; + ZA[840] = ZA[837] + ZA[839]; + + ZA[847] = (ZCh(ZA[843], ZA[838], ZA[833]) + ZA[846]) + ZR26(ZA[843]); + ZA[844] = ZMa(ZA[835], ZA[830], ZA[840]) + ZR30(ZA[840]); + ZA[678] = ZA[648] + ZA[677]; + ZA[676] = ZA[671] + K[37]; + + ZA[682] = ZR25(ZA[619]) + ZA[616]; + ZA[679] = ZR15(ZA[667]) + ZA[678]; + ZA[851] = ZA[833] + ZA[676]; + ZA[848] = ZA[830] + ZA[847]; + ZA[845] = ZA[842] + ZA[844]; + + ZA[852] = (ZCh(ZA[848], ZA[843], ZA[838]) + ZA[851]) + ZR26(ZA[848]); + ZA[849] = ZMa(ZA[840], ZA[835], ZA[845]) + ZR30(ZA[845]); + ZA[683] = ZA[651] + ZA[682]; + ZA[680] = ZA[679] + K[38]; + + ZA[686] = ZR25(ZA[622]) + ZA[619]; + ZA[684] = ZR15(ZA[671]) + ZA[683]; + ZA[856] = ZA[838] + ZA[680]; + ZA[853] = ZA[835] + ZA[852]; + ZA[850] = ZA[847] + ZA[849]; + + ZA[857] = (ZCh(ZA[853], ZA[848], ZA[843]) + ZA[856]) + ZR26(ZA[853]); + ZA[854] = ZMa(ZA[845], ZA[840], ZA[850]) + ZR30(ZA[850]); + ZA[687] = ZA[655] + ZA[686]; + ZA[685] = ZA[684] + K[39]; + + ZA[690] = ZR25(ZA[627]) + ZA[622]; + ZA[688] = ZR15(ZA[679]) + ZA[687]; + ZA[861] = ZA[843] + ZA[685]; + ZA[858] = ZA[840] + ZA[857]; + ZA[855] = ZA[852] + ZA[854]; + + ZA[862] = (ZCh(ZA[858], ZA[853], ZA[848]) + ZA[861]) + ZR26(ZA[858]); + ZA[859] = ZMa(ZA[850], ZA[845], ZA[855]) + ZR30(ZA[855]); + ZA[691] = ZA[659] + ZA[690]; + ZA[689] = ZA[688] + K[40]; + + ZA[694] = ZR25(ZA[631]) + ZA[627]; + ZA[692] = ZR15(ZA[684]) + ZA[691]; + ZA[866] = ZA[848] + ZA[689]; + ZA[863] = ZA[845] + ZA[862]; + ZA[860] = ZA[857] + ZA[859]; + + ZA[867] = (ZCh(ZA[863], ZA[858], ZA[853]) + ZA[866]) + ZR26(ZA[863]); + ZA[864] = ZMa(ZA[855], ZA[850], ZA[860]) + ZR30(ZA[860]); + ZA[695] = ZA[663] + ZA[694]; + ZA[693] = ZA[692] + K[41]; + + ZA[698] = ZR25(ZA[636]) + ZA[631]; + ZA[696] = ZR15(ZA[688]) + ZA[695]; + ZA[871] = ZA[853] + ZA[693]; + ZA[868] = ZA[850] + ZA[867]; + ZA[865] = ZA[862] + ZA[864]; + + ZA[873] = (ZCh(ZA[868], ZA[863], ZA[858]) + ZA[871]) + ZR26(ZA[868]); + ZA[869] = ZMa(ZA[860], ZA[855], ZA[865]) + ZR30(ZA[865]); + ZA[699] = ZA[667] + ZA[698]; + ZA[697] = ZA[696] + K[42]; + + ZA[702] = ZR25(ZA[640]) + ZA[636]; + ZA[700] = ZR15(ZA[692]) + ZA[699]; + ZA[877] = ZA[858] + ZA[697]; + ZA[874] = ZA[855] + ZA[873]; + ZA[870] = ZA[867] + ZA[869]; + + ZA[878] = (ZCh(ZA[874], ZA[868], ZA[863]) + ZA[877]) + ZR26(ZA[874]); + ZA[875] = ZMa(ZA[865], ZA[860], ZA[870]) + ZR30(ZA[870]); + ZA[703] = ZA[671] + ZA[702]; + ZA[701] = ZA[700] + K[43]; + + ZA[706] = ZR25(ZA[644]) + ZA[640]; + ZA[704] = ZR15(ZA[696]) + ZA[703]; + ZA[882] = ZA[863] + ZA[701]; + ZA[879] = ZA[860] + ZA[878]; + ZA[876] = ZA[873] + ZA[875]; + + ZA[883] = (ZCh(ZA[879], ZA[874], ZA[868]) + ZA[882]) + ZR26(ZA[879]); + ZA[880] = ZMa(ZA[870], ZA[865], ZA[876]) + ZR30(ZA[876]); + ZA[707] = ZA[679] + ZA[706]; + ZA[705] = ZA[704] + K[44]; + + ZA[710] = ZR25(ZA[648]) + ZA[644]; + ZA[708] = ZR15(ZA[700]) + ZA[707]; + ZA[887] = ZA[868] + ZA[705]; + ZA[884] = ZA[865] + ZA[883]; + ZA[881] = ZA[878] + ZA[880]; + + ZA[888] = (ZCh(ZA[884], ZA[879], ZA[874]) + ZA[887]) + ZR26(ZA[884]); + ZA[885] = ZMa(ZA[876], ZA[870], ZA[881]) + ZR30(ZA[881]); + ZA[711] = ZA[684] + ZA[710]; + ZA[709] = ZA[708] + K[45]; + + ZA[714] = ZR25(ZA[651]) + ZA[648]; + ZA[712] = ZR15(ZA[704]) + ZA[711]; + ZA[892] = ZA[874] + ZA[709]; + ZA[889] = ZA[870] + ZA[888]; + ZA[886] = ZA[883] + ZA[885]; + + ZA[893] = (ZCh(ZA[889], ZA[884], ZA[879]) + ZA[892]) + ZR26(ZA[889]); + ZA[890] = ZMa(ZA[881], ZA[876], ZA[886]) + ZR30(ZA[886]); + ZA[715] = ZA[688] + ZA[714]; + ZA[713] = ZA[712] + K[46]; + + ZA[718] = ZR25(ZA[655]) + ZA[651]; + ZA[716] = ZR15(ZA[708]) + ZA[715]; + ZA[897] = ZA[879] + ZA[713]; + ZA[894] = ZA[876] + ZA[893]; + ZA[891] = ZA[888] + ZA[890]; + + ZA[898] = (ZCh(ZA[894], ZA[889], ZA[884]) + ZA[897]) + ZR26(ZA[894]); + ZA[895] = ZMa(ZA[886], ZA[881], ZA[891]) + ZR30(ZA[891]); + ZA[719] = ZA[692] + ZA[718]; + ZA[717] = ZA[716] + K[47]; + + ZA[722] = ZR25(ZA[659]) + ZA[655]; + ZA[720] = ZR15(ZA[712]) + ZA[719]; + ZA[902] = ZA[884] + ZA[717]; + ZA[899] = ZA[881] + ZA[898]; + ZA[896] = ZA[893] + ZA[895]; + + ZA[903] = (ZCh(ZA[899], ZA[894], ZA[889]) + ZA[902]) + ZR26(ZA[899]); + ZA[900] = ZMa(ZA[891], ZA[886], ZA[896]) + ZR30(ZA[896]); + ZA[723] = ZA[696] + ZA[722]; + ZA[721] = ZA[720] + K[48]; + + ZA[672] = ZR25(ZA[663]) + ZA[659]; + ZA[724] = ZR15(ZA[716]) + ZA[723]; + ZA[907] = ZA[889] + ZA[721]; + ZA[904] = ZA[886] + ZA[903]; + ZA[901] = ZA[898] + ZA[900]; + + ZA[908] = (ZCh(ZA[904], ZA[899], ZA[894]) + ZA[907]) + ZR26(ZA[904]); + ZA[905] = ZMa(ZA[896], ZA[891], ZA[901]) + ZR30(ZA[901]); + ZA[673] = ZR25(ZA[667]) + ZA[663]; + ZA[726] = ZA[700] + ZA[672]; + ZA[725] = ZA[724] + K[49]; + + ZA[727] = ZR15(ZA[720]) + ZA[726]; + ZA[912] = ZA[894] + ZA[725]; + ZA[909] = ZA[891] + ZA[908]; + ZA[906] = ZA[903] + ZA[905]; + ZA[675] = ZA[667] + K[52]; + ZA[729] = ZA[704] + ZA[673]; + + ZA[913] = (ZCh(ZA[909], ZA[904], ZA[899]) + ZA[912]) + ZR26(ZA[909]); + ZA[910] = ZMa(ZA[901], ZA[896], ZA[906]) + ZR30(ZA[906]); + ZA[674] = ZR25(ZA[671]) + ZA[675]; + ZA[730] = ZR15(ZA[724]) + ZA[729]; + ZA[728] = ZA[727] + K[50]; + + ZA[681] = ZR25(ZA[679]) + ZA[671]; + ZA[917] = ZA[899] + ZA[901] + ZA[728]; + ZA[914] = ZA[896] + ZA[913]; + ZA[911] = ZA[908] + ZA[910]; + ZA[732] = ZA[708] + ZA[674]; + ZA[731] = ZA[730] + K[51]; + + ZA[918] = (ZCh(ZA[914], ZA[909], ZA[904]) + ZA[917]) + ZR26(ZA[914]); + ZA[915] = ZMa(ZA[906], ZA[901], ZA[911]) + ZR30(ZA[911]); + ZA[733] = ZR15(ZA[727]) + ZA[732]; + ZA[919] = ZA[906] + ZA[904] + ZA[731]; + ZA[734] = ZA[712] + ZA[681]; + + ZA[920] = (ZCh(ZA[918], ZA[914], ZA[909]) + ZA[919]) + ZR26(ZA[918]); + ZA[735] = ZR15(ZA[730]) + ZA[734]; + ZA[921] = ZA[911] + ZA[909] + ZA[733]; + ZA[916] = ZA[913] + ZA[915]; + + ZA[922] = (ZCh(ZA[920], ZA[918], ZA[914]) + ZA[921]) + ZR26(ZA[920]); + ZA[923] = ZA[916] + ZA[914] + ZA[735]; + + ZA[924] = (ZCh(ZA[922], ZA[920], ZA[918]) + ZA[923]) + ZR26(ZA[922]); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#if defined(VECTORS4) + bool result = any(ZA[924] == K[79]); + + if (result) { + if (ZA[924].x == K[79]) + SETFOUND(Znonce.x); + if (ZA[924].y == K[79]) + SETFOUND(Znonce.y); + if (ZA[924].z == K[79]) + SETFOUND(Znonce.z); + if (ZA[924].w == K[79]) + SETFOUND(Znonce.w); + } +#elif defined(VECTORS2) + bool result = any(ZA[924] == K[79]); + + if (result) { + if (ZA[924].x == K[79]) + SETFOUND(Znonce.x); + if (ZA[924].y == K[79]) + SETFOUND(Znonce.y); + } +#else + if (ZA[924] == K[79]) + SETFOUND(Znonce); +#endif +} diff --git a/bfgminer3.9/bin/diakgcn121016.cl b/bfgminer3.9/bin/diakgcn121016.cl new file mode 100755 index 0000000..b87fbde --- /dev/null +++ b/bfgminer3.9/bin/diakgcn121016.cl @@ -0,0 +1,599 @@ +// DiaKGCN 27-04-2012 - OpenCL kernel by Diapolo +// +// Parts and / or ideas for this kernel are based upon the public-domain poclbm project, the phatk kernel by Phateus and the DiabloMiner kernel by DiabloD3. +// The kernel was rewritten by me (Diapolo) and is still public-domain! + +#ifdef VECTORS4 + typedef uint4 u; +#elif defined VECTORS2 + typedef uint2 u; +#else + typedef uint u; +#endif + +#ifdef BITALIGN + #pragma OPENCL EXTENSION cl_amd_media_ops : enable + #ifdef BFI_INT + #define ch(x, y, z) amd_bytealign(x, y, z) + #define ma(x, y, z) amd_bytealign(z ^ x, y, x) + #else + #define ch(x, y, z) bitselect(z, y, x) + #define ma(z, x, y) bitselect(z, y, z ^ x) + #endif +#else + #define ch(x, y, z) (z ^ (x & (y ^ z))) + #define ma(x, y, z) ((x & z) | (y & (x | z))) +#endif + +#define rotr15(n) (rotate(n, 15U) ^ rotate(n, 13U) ^ (n >> 10U)) +#define rotr25(n) (rotate(n, 25U) ^ rotate(n, 14U) ^ (n >> 3U)) +#define rotr26(n) (rotate(n, 26U) ^ rotate(n, 21U) ^ rotate(n, 7U)) +#define rotr30(n) (rotate(n, 30U) ^ rotate(n, 19U) ^ rotate(n, 10U)) + +__kernel + __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) + void search( +#ifndef GOFFSET + const u base, +#endif + const uint PreVal0, const uint PreVal4, + const uint H1, const uint D1A, const uint B1, const uint C1, + const uint F1, const uint G1, const uint C1addK5, const uint B1addK6, const uint PreVal0addK7, + const uint W16addK16, const uint W17addK17, + const uint PreW18, const uint PreW19, + const uint W16, const uint W17, + const uint PreW31, const uint PreW32, + const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + const uint state0A, const uint state0B, + const uint state1A, const uint state2A, const uint state3A, const uint state4A, + const uint state5A, const uint state6A, const uint state7A, + volatile __global uint * output) +{ + u V[8]; + u W[16]; + +#ifdef VECTORS4 + const u nonce = (uint)(get_local_id(0)) * 4U + (uint)(get_group_id(0)) * (uint)(WORKVEC) + base; +#elif defined VECTORS2 + const u nonce = (uint)(get_local_id(0)) * 2U + (uint)(get_group_id(0)) * (uint)(WORKVEC) + base; +#else + #ifdef GOFFSET + const u nonce = (uint)(get_global_id(0)); + #else + const u nonce = (uint)(get_local_id(0)) + (uint)(get_group_id(0)) * (uint)(WORKSIZE) + base; + #endif +#endif + + V[0] = PreVal0 + nonce; + V[1] = B1; + V[2] = C1; + V[3] = D1A; + V[4] = PreVal4 + nonce; + V[5] = F1; + V[6] = G1; + V[7] = H1; + + V[7] += V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += C1addK5 + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = C1addK5 + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += B1addK6 + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = B1addK6 + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += PreVal0addK7 + nonce + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = PreVal0addK7 + nonce + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0xd807aa98U + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0xd807aa98U + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x12835b01U + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x12835b01U + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x243185beU + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x243185beU + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x550c7dc3U + V[4] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x550c7dc3U + V[4] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x72be5d74U + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x72be5d74U + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x80deb1feU + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x80deb1feU + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x9bdc06a7U + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x9bdc06a7U + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0xc19bf3f4U + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0xc19bf3f4U + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += W16addK16 + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = W16addK16 + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += W17addK17 + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = W17addK17 + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + +//---------------------------------------------------------------------------------- + +#ifdef VECTORS4 + W[0] = PreW18 + (u)(rotr25(nonce.x), rotr25(nonce.x) ^ 0x2004000U, rotr25(nonce.x) ^ 0x4008000U, rotr25(nonce.x) ^ 0x600c000U); +#elif defined VECTORS2 + W[0] = PreW18 + (u)(rotr25(nonce.x), rotr25(nonce.x) ^ 0x2004000U); +#else + W[0] = PreW18 + rotr25(nonce); +#endif + W[1] = PreW19 + nonce; + W[2] = 0x80000000U + rotr15(W[0]); + W[3] = rotr15(W[1]); + W[4] = 0x00000280U + rotr15(W[2]); + W[5] = W16 + rotr15(W[3]); + W[6] = W17 + rotr15(W[4]); + W[7] = W[0] + rotr15(W[5]); + W[8] = W[1] + rotr15(W[6]); + W[9] = W[2] + rotr15(W[7]); + W[10] = W[3] + rotr15(W[8]); + W[11] = W[4] + rotr15(W[9]); + W[12] = W[5] + 0x00a00055U + rotr15(W[10]); + W[13] = W[6] + PreW31 + rotr15(W[11]); + W[14] = W[7] + PreW32 + rotr15(W[12]); + W[15] = W[8] + W17 + rotr15(W[13]) + rotr25(W[0]); + + V[1] += 0x0fc19dc6U + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + W[0]; + V[5] = 0x0fc19dc6U + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + W[0] + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x240ca1ccU + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x240ca1ccU + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x2de92c6fU + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x2de92c6fU + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x4a7484aaU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x4a7484aaU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x5cb0a9dcU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x5cb0a9dcU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x76f988daU + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x76f988daU + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x983e5152U + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x983e5152U + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xa831c66dU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xa831c66dU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0xb00327c8U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0xb00327c8U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0xbf597fc7U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0xbf597fc7U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0xc6e00bf3U + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0xc6e00bf3U + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xd5a79147U + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xd5a79147U + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x06ca6351U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x06ca6351U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x14292967U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x14292967U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x27b70a85U + V[7] + W[14] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x27b70a85U + V[7] + W[14] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x2e1b2138U + V[6] + W[15] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x2e1b2138U + V[6] + W[15] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + +//---------------------------------------------------------------------------------- + + W[0] = W[0] + W[9] + rotr15(W[14]) + rotr25( W[1]); + W[1] = W[1] + W[10] + rotr15(W[15]) + rotr25( W[2]); + W[2] = W[2] + W[11] + rotr15( W[0]) + rotr25( W[3]); + W[3] = W[3] + W[12] + rotr15( W[1]) + rotr25( W[4]); + W[4] = W[4] + W[13] + rotr15( W[2]) + rotr25( W[5]); + W[5] = W[5] + W[14] + rotr15( W[3]) + rotr25( W[6]); + W[6] = W[6] + W[15] + rotr15( W[4]) + rotr25( W[7]); + W[7] = W[7] + W[0] + rotr15( W[5]) + rotr25( W[8]); + W[8] = W[8] + W[1] + rotr15( W[6]) + rotr25( W[9]); + W[9] = W[9] + W[2] + rotr15( W[7]) + rotr25(W[10]); + W[10] = W[10] + W[3] + rotr15( W[8]) + rotr25(W[11]); + W[11] = W[11] + W[4] + rotr15( W[9]) + rotr25(W[12]); + W[12] = W[12] + W[5] + rotr15(W[10]) + rotr25(W[13]); + W[13] = W[13] + W[6] + rotr15(W[11]) + rotr25(W[14]); + W[14] = W[14] + W[7] + rotr15(W[12]) + rotr25(W[15]); + W[15] = W[15] + W[8] + rotr15(W[13]) + rotr25( W[0]); + + V[1] += 0x4d2c6dfcU + V[5] + W[0] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x4d2c6dfcU + V[5] + W[0] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x53380d13U + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x53380d13U + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x650a7354U + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x650a7354U + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x766a0abbU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x766a0abbU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x81c2c92eU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x81c2c92eU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x92722c85U + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x92722c85U + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0xa2bfe8a1U + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0xa2bfe8a1U + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xa81a664bU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xa81a664bU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0xc24b8b70U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0xc24b8b70U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0xc76c51a3U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0xc76c51a3U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0xd192e819U + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0xd192e819U + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xd6990624U + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xd6990624U + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0xf40e3585U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0xf40e3585U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x106aa070U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x106aa070U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x19a4c116U + V[7] + W[14] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x19a4c116U + V[7] + W[14] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x1e376c08U + V[6] + W[15] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x1e376c08U + V[6] + W[15] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + +//---------------------------------------------------------------------------------- + + W[0] = W[0] + W[9] + rotr15(W[14]) + rotr25( W[1]); + W[1] = W[1] + W[10] + rotr15(W[15]) + rotr25( W[2]); + W[2] = W[2] + W[11] + rotr15( W[0]) + rotr25( W[3]); + W[3] = W[3] + W[12] + rotr15( W[1]) + rotr25( W[4]); + W[4] = W[4] + W[13] + rotr15( W[2]) + rotr25( W[5]); + W[5] = W[5] + W[14] + rotr15( W[3]) + rotr25( W[6]); + W[6] = W[6] + W[15] + rotr15( W[4]) + rotr25( W[7]); + W[7] = W[7] + W[0] + rotr15( W[5]) + rotr25( W[8]); + W[8] = W[8] + W[1] + rotr15( W[6]) + rotr25( W[9]); + W[9] = W[9] + W[2] + rotr15( W[7]) + rotr25(W[10]); + W[10] = W[10] + W[3] + rotr15( W[8]) + rotr25(W[11]); + W[11] = W[11] + W[4] + rotr15( W[9]) + rotr25(W[12]); + W[12] = W[12] + W[5] + rotr15(W[10]) + rotr25(W[13]); + W[13] = W[13] + W[6] + rotr15(W[11]) + rotr25(W[14]); + + V[1] += 0x2748774cU + V[5] + W[0] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x2748774cU + V[5] + W[0] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x34b0bcb5U + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x34b0bcb5U + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x391c0cb3U + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x391c0cb3U + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x4ed8aa4aU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x4ed8aa4aU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x5b9cca4fU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x5b9cca4fU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x682e6ff3U + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x682e6ff3U + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x748f82eeU + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x748f82eeU + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x78a5636fU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x78a5636fU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x84c87814U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x84c87814U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x8cc70208U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x8cc70208U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x90befffaU + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x90befffaU + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xa4506cebU + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xa4506cebU + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0xbef9a3f7U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0xbef9a3f7U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0xc67178f2U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0xc67178f2U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + +//---------------------------------------------------------------------------------- + + W[0] = state0 + V[0] + rotr25(state1 + V[1]); + W[1] = state1 + V[1] + 0x00a00000U + rotr25(state2 + V[2]); + W[2] = state2 + V[2] + rotr15(W[0]) + rotr25(state3 + V[3]); + W[3] = state3 + V[3] + rotr15(W[1]) + rotr25(state4 + V[4]); + W[4] = state4 + V[4] + rotr15(W[2]) + rotr25(state5 + V[5]); + W[5] = state5 + V[5] + rotr15(W[3]) + rotr25(state6 + V[6]); + W[6] = state6 + V[6] + 0x00000100U + rotr15(W[4]) + rotr25(state7 + V[7]); + W[7] = state7 + V[7] + W[0] + 0x11002000U + rotr15(W[5]); + W[8] = W[1] + 0x80000000U + rotr15(W[6]); + W[9] = W[2] + rotr15(W[7]); + W[10] = W[3] + rotr15(W[8]); + W[11] = W[4] + rotr15(W[9]); + W[12] = W[5] + rotr15(W[10]); + W[13] = W[6] + rotr15(W[11]); + W[14] = W[7] + 0x00400022U + rotr15(W[12]); + W[15] = W[8] + 0x00000100U + rotr15(W[13]) + rotr25(W[0]); + + // 0x71374491U + 0x1f83d9abU + state1 + const u state1AaddV1 = state1A + V[1]; + // 0xb5c0fbcfU + 0x9b05688cU + state2 + const u state2AaddV2 = state2A + V[2]; + // 0x510e527fU + 0xe9b5dba5U + state3 + const u state3AaddV3 = state3A + V[3]; + // 0x3956c25bU + state4 + const u state4AaddV4 = state4A + V[4]; + // 0x59f111f1U + state5 + const u state5AaddV5 = state5A + V[5]; + // 0x923f82a4U + state6 + const u state6AaddV6 = state6A + V[6]; + // 0xab1c5ed5U + state7 + const u state7AaddV7 = state7A + V[7]; + + // 0x98c7e2a2U + state0 + V[3] = state0A + V[0]; + // 0xfc08884dU + state0 + V[7] = state0B + V[0]; + V[0] = 0x6a09e667U; + V[1] = 0xbb67ae85U; + V[2] = 0x3c6ef372U; + V[4] = 0x510e527fU; + V[5] = 0x9b05688cU; + V[6] = 0x1f83d9abU; + + V[2] += state1AaddV1 + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = state1AaddV1 + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += state2AaddV2 + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = state2AaddV2 + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += state3AaddV3 + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = state3AaddV3 + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += state4AaddV4 + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = state4AaddV4 + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += state5AaddV5 + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = state5AaddV5 + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += state6AaddV6 + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = state6AaddV6 + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += state7AaddV7 + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = state7AaddV7 + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x5807aa98U + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x5807aa98U + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x12835b01U + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x12835b01U + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x243185beU + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x243185beU + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x550c7dc3U + V[4] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x550c7dc3U + V[4] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x72be5d74U + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x72be5d74U + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x80deb1feU + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x80deb1feU + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x9bdc06a7U + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x9bdc06a7U + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0xc19bf274U + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0xc19bf274U + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0xe49b69c1U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0xe49b69c1U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xefbe4786U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xefbe4786U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x0fc19dc6U + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x0fc19dc6U + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x240ca1ccU + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x240ca1ccU + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x2de92c6fU + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x2de92c6fU + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x4a7484aaU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x4a7484aaU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x5cb0a9dcU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x5cb0a9dcU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x76f988daU + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x76f988daU + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x983e5152U + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x983e5152U + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xa831c66dU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xa831c66dU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0xb00327c8U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0xb00327c8U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0xbf597fc7U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0xbf597fc7U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0xc6e00bf3U + V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0xc6e00bf3U + V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xd5a79147U + V[2] + W[13] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xd5a79147U + V[2] + W[13] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x06ca6351U + V[1] + W[14] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x06ca6351U + V[1] + W[14] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x14292967U + V[0] + W[15] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x14292967U + V[0] + W[15] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + +//---------------------------------------------------------------------------------- + + W[0] = W[0] + W[9] + rotr15(W[14]) + rotr25( W[1]); + W[1] = W[1] + W[10] + rotr15(W[15]) + rotr25( W[2]); + W[2] = W[2] + W[11] + rotr15( W[0]) + rotr25( W[3]); + W[3] = W[3] + W[12] + rotr15( W[1]) + rotr25( W[4]); + W[4] = W[4] + W[13] + rotr15( W[2]) + rotr25( W[5]); + W[5] = W[5] + W[14] + rotr15( W[3]) + rotr25( W[6]); + W[6] = W[6] + W[15] + rotr15( W[4]) + rotr25( W[7]); + W[7] = W[7] + W[0] + rotr15( W[5]) + rotr25( W[8]); + W[8] = W[8] + W[1] + rotr15( W[6]) + rotr25( W[9]); + W[9] = W[9] + W[2] + rotr15( W[7]) + rotr25(W[10]); + W[10] = W[10] + W[3] + rotr15( W[8]) + rotr25(W[11]); + W[11] = W[11] + W[4] + rotr15( W[9]) + rotr25(W[12]); + W[12] = W[12] + W[5] + rotr15(W[10]) + rotr25(W[13]); + W[13] = W[13] + W[6] + rotr15(W[11]) + rotr25(W[14]); + W[14] = W[14] + W[7] + rotr15(W[12]) + rotr25(W[15]); + W[15] = W[15] + W[8] + rotr15(W[13]) + rotr25( W[0]); + + V[3] += 0x27b70a85U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x27b70a85U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x2e1b2138U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x2e1b2138U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x4d2c6dfcU + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x4d2c6dfcU + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x53380d13U + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x53380d13U + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x650a7354U + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x650a7354U + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x766a0abbU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x766a0abbU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x81c2c92eU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x81c2c92eU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x92722c85U + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x92722c85U + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0xa2bfe8a1U + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0xa2bfe8a1U + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xa81a664bU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xa81a664bU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0xc24b8b70U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0xc24b8b70U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0xc76c51a3U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0xc76c51a3U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0xd192e819U + V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0xd192e819U + V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xd6990624U + V[2] + W[13] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xd6990624U + V[2] + W[13] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0xf40e3585U + V[1] + W[14] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0xf40e3585U + V[1] + W[14] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x106aa070U + V[0] + W[15] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x106aa070U + V[0] + W[15] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + +//---------------------------------------------------------------------------------- + + W[0] = W[0] + W[9] + rotr15(W[14]) + rotr25( W[1]); + W[1] = W[1] + W[10] + rotr15(W[15]) + rotr25( W[2]); + W[2] = W[2] + W[11] + rotr15( W[0]) + rotr25( W[3]); + W[3] = W[3] + W[12] + rotr15( W[1]) + rotr25( W[4]); + W[4] = W[4] + W[13] + rotr15( W[2]) + rotr25( W[5]); + W[5] = W[5] + W[14] + rotr15( W[3]) + rotr25( W[6]); + W[6] = W[6] + W[15] + rotr15( W[4]) + rotr25( W[7]); + W[7] = W[7] + W[0] + rotr15( W[5]) + rotr25( W[8]); + W[8] = W[8] + W[1] + rotr15( W[6]) + rotr25( W[9]); + W[9] = W[9] + W[2] + rotr15( W[7]) + rotr25(W[10]); + W[10] = W[10] + W[3] + rotr15( W[8]) + rotr25(W[11]); + W[11] = W[11] + W[4] + rotr15( W[9]) + rotr25(W[12]); + W[12] = W[12] + W[5] + rotr15(W[10]) + rotr25(W[13]); + + V[3] += 0x19a4c116U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x19a4c116U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x1e376c08U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x1e376c08U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x2748774cU + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x2748774cU + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x34b0bcb5U + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x34b0bcb5U + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x391c0cb3U + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x391c0cb3U + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x4ed8aa4aU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x4ed8aa4aU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x5b9cca4fU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x5b9cca4fU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x682e6ff3U + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x682e6ff3U + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x748f82eeU + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x748f82eeU + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x78a5636fU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + + V[1] += 0x84c87814U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + + V[0] += 0x8cc70208U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + + V[7] += V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#ifdef VECTORS4 + if ((V[7].x == 0x136032edU) ^ (V[7].y == 0x136032edU) ^ (V[7].z == 0x136032edU) ^ (V[7].w == 0x136032edU)) { + if (V[7].x == 0x136032edU) + SETFOUND(nonce.x); + if (V[7].y == 0x136032edU) + SETFOUND(nonce.y); + if (V[7].z == 0x136032edU) + SETFOUND(nonce.z); + if (V[7].w == 0x136032edU) + SETFOUND(nonce.w); + } +#elif defined VECTORS2 + if ((V[7].x == 0x136032edU) + (V[7].y == 0x136032edU)) { + if (V[7].x == 0x136032edU) + SETFOUND(nonce.x); + if (V[7].y == 0x136032edU) + SETFOUND(nonce.y); + } +#else + if (V[7] == 0x136032edU) + SETFOUND(nonce); +#endif +} diff --git a/bfgminer3.9/bin/phatk121016.cl b/bfgminer3.9/bin/phatk121016.cl new file mode 100755 index 0000000..60f2870 --- /dev/null +++ b/bfgminer3.9/bin/phatk121016.cl @@ -0,0 +1,417 @@ +// This file is taken and modified from the public-domain poclbm project, and +// I have therefore decided to keep it public-domain. +// Modified version copyright 2011-2012 Con Kolivas + +#ifdef VECTORS4 + typedef uint4 u; +#elif defined VECTORS2 + typedef uint2 u; +#else + typedef uint u; +#endif + +__constant uint K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +__constant uint ConstW[128] = { +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000U, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000280U, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x80000000U, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100U, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +__constant uint H[8] = { + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +}; + + +#ifdef BITALIGN + #pragma OPENCL EXTENSION cl_amd_media_ops : enable + #define rot(x, y) amd_bitalign(x, x, (uint)(32 - y)) + +// This part is not from the stock poclbm kernel. It's part of an optimization +// added in the Phoenix Miner. + +// Some AMD devices have Vals[0] BFI_INT opcode, which behaves exactly like the +// SHA-256 Ch function, but provides it in exactly one instruction. If +// detected, use it for Ch. Otherwise, construct Ch out of simpler logical +// primitives. + + #ifdef BFI_INT + // Well, slight problem... It turns out BFI_INT isn't actually exposed to + // OpenCL (or CAL IL for that matter) in any way. However, there is + // a similar instruction, BYTE_ALIGN_INT, which is exposed to OpenCL via + // amd_bytealign, takes the same inputs, and provides the same output. + // We can use that as a placeholder for BFI_INT and have the application + // patch it after compilation. + + // This is the BFI_INT function + #define Ch(x, y, z) amd_bytealign(x,y,z) + // Ma can also be implemented in terms of BFI_INT... + #define Ma(z, x, y) amd_bytealign(z^x,y,x) + #else // BFI_INT + // Later SDKs optimise this to BFI INT without patching and GCN + // actually fails if manually patched with BFI_INT + + #define Ch(x, y, z) bitselect((u)z, (u)y, (u)x) + #define Ma(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) + #define rotr(x, y) amd_bitalign((u)x, (u)x, (u)y) + #endif +#else // BITALIGN + #define Ch(x, y, z) (z ^ (x & (y ^ z))) + #define Ma(x, y, z) ((x & z) | (y & (x | z))) + #define rot(x, y) rotate((u)x, (u)y) + #define rotr(x, y) rotate((u)x, (u)(32-y)) +#endif + + + +//Various intermediate calculations for each SHA round +#define s0(n) (S0(Vals[(0 + 128 - (n)) % 8])) +#define S0(n) (rot(n, 30u)^rot(n, 19u)^rot(n,10u)) + +#define s1(n) (S1(Vals[(4 + 128 - (n)) % 8])) +#define S1(n) (rot(n, 26u)^rot(n, 21u)^rot(n, 7u)) + +#define ch(n) Ch(Vals[(4 + 128 - (n)) % 8],Vals[(5 + 128 - (n)) % 8],Vals[(6 + 128 - (n)) % 8]) +#define maj(n) Ma(Vals[(1 + 128 - (n)) % 8],Vals[(2 + 128 - (n)) % 8],Vals[(0 + 128 - (n)) % 8]) + +//t1 calc when W is already calculated +#define t1(n) K[(n) % 64] + Vals[(7 + 128 - (n)) % 8] + W[(n)] + s1(n) + ch(n) + +//t1 calc which calculates W +#define t1W(n) K[(n) % 64] + Vals[(7 + 128 - (n)) % 8] + W(n) + s1(n) + ch(n) + +//Used for constant W Values (the compiler optimizes out zeros) +#define t1C(n) (K[(n) % 64]+ ConstW[(n)]) + Vals[(7 + 128 - (n)) % 8] + s1(n) + ch(n) + +//t2 Calc +#define t2(n) maj(n) + s0(n) + +#define rotC(x,n) (x<> (32-n)) + +//W calculation used for SHA round +#define W(n) (W[n] = P4(n) + P3(n) + P2(n) + P1(n)) + + + +//Partial W calculations (used for the begining where only some values are nonzero) +#define P1(n) ((rot(W[(n)-2],15u)^rot(W[(n)-2],13u)^((W[(n)-2])>>10U))) +#define P2(n) ((rot(W[(n)-15],25u)^rot(W[(n)-15],14u)^((W[(n)-15])>>3U))) + + +#define p1(x) ((rot(x,15u)^rot(x,13u)^((x)>>10U))) +#define p2(x) ((rot(x,25u)^rot(x,14u)^((x)>>3U))) + + +#define P3(n) W[n-7] +#define P4(n) W[n-16] + + +//Partial Calcs for constant W values +#define P1C(n) ((rotC(ConstW[(n)-2],15)^rotC(ConstW[(n)-2],13)^((ConstW[(n)-2])>>10U))) +#define P2C(n) ((rotC(ConstW[(n)-15],25)^rotC(ConstW[(n)-15],14)^((ConstW[(n)-15])>>3U))) +#define P3C(x) ConstW[x-7] +#define P4C(x) ConstW[x-16] + +//SHA round with built in W calc +#define sharoundW(n) Barrier1(n); Vals[(3 + 128 - (n)) % 8] += t1W(n); Vals[(7 + 128 - (n)) % 8] = t1W(n) + t2(n); + +//SHA round without W calc +#define sharound(n) Barrier2(n); Vals[(3 + 128 - (n)) % 8] += t1(n); Vals[(7 + 128 - (n)) % 8] = t1(n) + t2(n); + +//SHA round for constant W values +#define sharoundC(n) Barrier3(n); Vals[(3 + 128 - (n)) % 8] += t1C(n); Vals[(7 + 128 - (n)) % 8] = t1C(n) + t2(n); + +//The compiler is stupid... I put this in there only to stop the compiler from (de)optimizing the order +#define Barrier1(n) t1 = t1C((n+1)) +#define Barrier2(n) t1 = t1C((n)) +#define Barrier3(n) t1 = t1C((n)) + +//#define WORKSIZE 256 +#define MAXBUFFERS (4095) + +__kernel + __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) +void search( const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + const uint B1, const uint C1, const uint D1, + const uint F1, const uint G1, const uint H1, + const u base, + const uint W16, const uint W17, + const uint PreVal4, const uint PreVal0, + const uint PreW18, const uint PreW19, + const uint PreW31, const uint PreW32, + + volatile __global uint * output) +{ + + + u W[124]; + u Vals[8]; + +//Dummy Variable to prevent compiler from reordering between rounds + u t1; + + //Vals[0]=state0; + Vals[1]=B1; + Vals[2]=C1; + Vals[3]=D1; + //Vals[4]=PreVal4; + Vals[5]=F1; + Vals[6]=G1; + Vals[7]=H1; + + W[16] = W16; + W[17] = W17; + +#ifdef VECTORS4 + //Less dependencies to get both the local id and group id and then add them + W[3] = base + (uint)(get_local_id(0)) * 4u + (uint)(get_group_id(0)) * (WORKSIZE * 4u); + uint r = rot(W[3].x,25u)^rot(W[3].x,14u)^((W[3].x)>>3U); + //Since only the 2 LSB is opposite between the nonces, we can save an instruction by flipping the 4 bits in W18 rather than the 1 bit in W3 + W[18] = PreW18 + (u){r, r ^ 0x2004000U, r ^ 0x4008000U, r ^ 0x600C000U}; +#elif defined VECTORS2 + W[3] = base + (uint)(get_local_id(0)) * 2u + (uint)(get_group_id(0)) * (WORKSIZE * 2u); + uint r = rot(W[3].x,25u)^rot(W[3].x,14u)^((W[3].x)>>3U); + W[18] = PreW18 + (u){r, r ^ 0x2004000U}; +#else + W[3] = base + get_local_id(0) + get_group_id(0) * (WORKSIZE); + u r = rot(W[3],25u)^rot(W[3],14u)^((W[3])>>3U); + W[18] = PreW18 + r; +#endif + //the order of the W calcs and Rounds is like this because the compiler needs help finding how to order the instructions + + + + Vals[4] = PreVal4 + W[3]; + Vals[0] = PreVal0 + W[3]; + + sharoundC(4); + W[19] = PreW19 + W[3]; + sharoundC(5); + W[20] = P4C(20) + P1(20); + sharoundC(6); + W[21] = P1(21); + sharoundC(7); + W[22] = P3C(22) + P1(22); + sharoundC(8); + W[23] = W[16] + P1(23); + sharoundC(9); + W[24] = W[17] + P1(24); + sharoundC(10); + W[25] = P1(25) + P3(25); + W[26] = P1(26) + P3(26); + sharoundC(11); + W[27] = P1(27) + P3(27); + W[28] = P1(28) + P3(28); + sharoundC(12); + W[29] = P1(29) + P3(29); + sharoundC(13); + W[30] = P1(30) + P2C(30) + P3(30); + W[31] = PreW31 + (P1(31) + P3(31)); + sharoundC(14); + W[32] = PreW32 + (P1(32) + P3(32)); + sharoundC(15); + sharound(16); + sharound(17); + sharound(18); + sharound(19); + sharound(20); + sharound(21); + sharound(22); + sharound(23); + sharound(24); + sharound(25); + sharound(26); + sharound(27); + sharound(28); + sharound(29); + sharound(30); + sharound(31); + sharound(32); + sharoundW(33); + sharoundW(34); + sharoundW(35); + sharoundW(36); + sharoundW(37); + sharoundW(38); + sharoundW(39); + sharoundW(40); + sharoundW(41); + sharoundW(42); + sharoundW(43); + sharoundW(44); + sharoundW(45); + sharoundW(46); + sharoundW(47); + sharoundW(48); + sharoundW(49); + sharoundW(50); + sharoundW(51); + sharoundW(52); + sharoundW(53); + sharoundW(54); + sharoundW(55); + sharoundW(56); + sharoundW(57); + sharoundW(58); + sharoundW(59); + sharoundW(60); + sharoundW(61); + sharoundW(62); + sharoundW(63); + + W[64]=state0+Vals[0]; + W[65]=state1+Vals[1]; + W[66]=state2+Vals[2]; + W[67]=state3+Vals[3]; + W[68]=state4+Vals[4]; + W[69]=state5+Vals[5]; + W[70]=state6+Vals[6]; + W[71]=state7+Vals[7]; + + Vals[0]=H[0]; + Vals[1]=H[1]; + Vals[2]=H[2]; + Vals[3]=H[3]; + Vals[4]=H[4]; + Vals[5]=H[5]; + Vals[6]=H[6]; + Vals[7]=H[7]; + + //sharound(64 + 0); + const u Temp = (0xb0edbdd0U + K[0]) + W[64]; + Vals[7] = Temp + 0x08909ae5U; + Vals[3] = 0xa54ff53aU + Temp; + +#define P124(n) P2(n) + P1(n) + P4(n) + + + W[64 + 16] = + P2(64 + 16) + P4(64 + 16); + sharound(64 + 1); + W[64 + 17] = P1C(64 + 17) + P2(64 + 17) + P4(64 + 17); + sharound(64 + 2); + W[64 + 18] = P124(64 + 18); + sharound(64 + 3); + W[64 + 19] = P124(64 + 19); + sharound(64 + 4); + W[64 + 20] = P124(64 + 20); + sharound(64 + 5); + W[64 + 21] = P124(64 + 21); + sharound(64 + 6); + W[64 + 22] = P4(64 + 22) + P3C(64 + 22) + P2(64 + 22) + P1(64 + 22); + sharound(64 + 7); + W[64 + 23] = P4(64 + 23) + P3(64 + 23) + P2C(64 + 23) + P1(64 + 23); + sharoundC(64 + 8); + W[64 + 24] = P1(64 + 24) + P4C(64 + 24) + P3(64 + 24); + sharoundC(64 + 9); + W[64 + 25] = P3(64 + 25) + P1(64 + 25); + sharoundC(64 + 10); + W[64 + 26] = P3(64 + 26) + P1(64 + 26); + sharoundC(64 + 11); + W[64 + 27] = P3(64 + 27) + P1(64 + 27); + sharoundC(64 + 12); + W[64 + 28] = P3(64 + 28) + P1(64 + 28); + sharoundC(64 + 13); + W[64 + 29] = P1(64 + 29) + P3(64 + 29); + W[64 + 30] = P3(64 + 30) + P2C(64 + 30) + P1(64 + 30); + sharoundC(64 + 14); + W[64 + 31] = P4C(64 + 31) + P3(64 + 31) + P2(64 + 31) + P1(64 + 31); + sharoundC(64 + 15); + sharound(64 + 16); + sharound(64 + 17); + sharound(64 + 18); + sharound(64 + 19); + sharound(64 + 20); + sharound(64 + 21); + sharound(64 + 22); + sharound(64 + 23); + sharound(64 + 24); + sharound(64 + 25); + sharound(64 + 26); + sharound(64 + 27); + sharound(64 + 28); + sharound(64 + 29); + sharound(64 + 30); + sharound(64 + 31); + sharoundW(64 + 32); + sharoundW(64 + 33); + sharoundW(64 + 34); + sharoundW(64 + 35); + sharoundW(64 + 36); + sharoundW(64 + 37); + sharoundW(64 + 38); + sharoundW(64 + 39); + sharoundW(64 + 40); + sharoundW(64 + 41); + sharoundW(64 + 42); + sharoundW(64 + 43); + sharoundW(64 + 44); + sharoundW(64 + 45); + sharoundW(64 + 46); + sharoundW(64 + 47); + sharoundW(64 + 48); + sharoundW(64 + 49); + sharoundW(64 + 50); + sharoundW(64 + 51); + sharoundW(64 + 52); + sharoundW(64 + 53); + sharoundW(64 + 54); + sharoundW(64 + 55); + sharoundW(64 + 56); + sharoundW(64 + 57); + sharoundW(64 + 58); + + W[117] += W[108] + Vals[3] + Vals[7] + P2(124) + P1(124) + Ch((Vals[0] + Vals[4]) + (K[59] + W(59+64)) + s1(64+59)+ ch(59+64),Vals[1],Vals[2]) - + (-(K[60] + H[7]) - S1((Vals[0] + Vals[4]) + (K[59] + W(59+64)) + s1(64+59)+ ch(59+64))); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#ifdef VECTORS4 + bool result = W[117].x & W[117].y & W[117].z & W[117].w; + if (!result) { + if (!W[117].x) + SETFOUND(W[3].x); + if (!W[117].y) + SETFOUND(W[3].y); + if (!W[117].z) + SETFOUND(W[3].z); + if (!W[117].w) + SETFOUND(W[3].w); + } +#elif defined VECTORS2 + bool result = W[117].x & W[117].y; + if (!result) { + if (!W[117].x) + SETFOUND(W[3].x); + if (!W[117].y) + SETFOUND(W[3].y); + } +#else + if (!W[117]) + SETFOUND(W[3]); +#endif +} diff --git a/bfgminer3.9/bin/poclbm121016.cl b/bfgminer3.9/bin/poclbm121016.cl new file mode 100755 index 0000000..d30f73f --- /dev/null +++ b/bfgminer3.9/bin/poclbm121016.cl @@ -0,0 +1,1344 @@ +// -ck modified kernel taken from Phoenix taken from poclbm, with aspects of +// phatk and others. +// Modified version copyright 2011-2012 Con Kolivas + +// This file is taken and modified from the public-domain poclbm project, and +// we have therefore decided to keep it public-domain in Phoenix. + +#ifdef VECTORS4 + typedef uint4 u; +#elif defined VECTORS2 + typedef uint2 u; +#else + typedef uint u; +#endif + +__constant uint K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + + +// This part is not from the stock poclbm kernel. It's part of an optimization +// added in the Phoenix Miner. + +// Some AMD devices have a BFI_INT opcode, which behaves exactly like the +// SHA-256 ch function, but provides it in exactly one instruction. If +// detected, use it for ch. Otherwise, construct ch out of simpler logical +// primitives. + +#ifdef BITALIGN + #pragma OPENCL EXTENSION cl_amd_media_ops : enable + #define rotr(x, y) amd_bitalign((u)x, (u)x, (u)y) +#else + #define rotr(x, y) rotate((u)x, (u)(32 - y)) +#endif +#ifdef BFI_INT + // Well, slight problem... It turns out BFI_INT isn't actually exposed to + // OpenCL (or CAL IL for that matter) in any way. However, there is + // a similar instruction, BYTE_ALIGN_INT, which is exposed to OpenCL via + // amd_bytealign, takes the same inputs, and provides the same output. + // We can use that as a placeholder for BFI_INT and have the application + // patch it after compilation. + + // This is the BFI_INT function + #define ch(x, y, z) amd_bytealign(x, y, z) + + // Ma can also be implemented in terms of BFI_INT... + #define Ma(x, y, z) amd_bytealign( (z^x), (y), (x) ) + + // AMD's KernelAnalyzer throws errors compiling the kernel if we use + // amd_bytealign on constants with vectors enabled, so we use this to avoid + // problems. (this is used 4 times, and likely optimized out by the compiler.) + #define Ma2(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) +#else // BFI_INT + //GCN actually fails if manually patched with BFI_INT + + #define ch(x, y, z) bitselect((u)z, (u)y, (u)x) + #define Ma(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) + #define Ma2(x, y, z) Ma(x, y, z) +#endif + + +__kernel +__attribute__((vec_type_hint(u))) +__attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) +void search(const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + const uint b1, const uint c1, + const uint f1, const uint g1, const uint h1, +#ifndef GOFFSET + const u base, +#endif + const uint fw0, const uint fw1, const uint fw2, const uint fw3, const uint fw15, const uint fw01r, + const uint D1A, const uint C1addK5, const uint B1addK6, + const uint W16addK16, const uint W17addK17, + const uint PreVal4addT1, const uint Preval0, + volatile __global uint * output) +{ + u Vals[24]; + u *W = &Vals[8]; + +#ifdef GOFFSET + const u nonce = (uint)(get_global_id(0)); +#else + const u nonce = base + (uint)(get_global_id(0)); +#endif + +Vals[5]=Preval0; +Vals[5]+=nonce; + +Vals[0]=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],b1,c1); +Vals[0]+=D1A; + +Vals[2]=Vals[0]; +Vals[2]+=h1; + +Vals[1]=PreVal4addT1; +Vals[1]+=nonce; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); + +Vals[6]=C1addK5; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],b1); + +Vals[3]=Vals[6]; +Vals[3]+=g1; +Vals[0]+=Ma2(g1,Vals[1],f1); +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma2(f1,Vals[0],Vals[1]); + +Vals[7]=B1addK6; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); + +Vals[4]=Vals[7]; +Vals[4]+=f1; + +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[7]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[8]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[9]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[10]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[11]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[12]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[13]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[14]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=0xC19BF3F4U; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=W16addK16; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=W17addK17; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]=(rotr(nonce,7)^rotr(nonce,18)^(nonce>>3U)); +W[2]+=fw2; +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[18]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]=nonce; +W[3]+=fw3; +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[19]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +W[4]+=0x80000000U; +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[20]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[21]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +W[6]+=0x00000280U; +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[22]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +W[7]+=fw0; +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[23]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +W[8]+=fw1; +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[24]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[25]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[26]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[27]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[28]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[29]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]=0x00a00055U; +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[30]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]=fw15; +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[31]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]=fw01r; +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[32]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]=fw1; +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[33]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[34]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[35]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[36]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[37]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[38]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[39]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[40]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[41]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[42]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[43]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[44]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[45]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[46]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[47]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[48]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[49]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[50]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[51]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[52]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[53]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[54]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[55]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[56]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[57]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[58]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[59]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[60]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[61]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=W[14]; +Vals[7]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +Vals[7]+=W[7]; +Vals[7]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[62]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=W[15]; +Vals[5]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +Vals[5]+=W[8]; +Vals[5]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[63]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[5]+=state0; + +W[7]=state7; +W[7]+=Vals[2]; + +Vals[2]=0xF377ED68U; +Vals[2]+=Vals[5]; + +W[3]=state3; +W[3]+=Vals[0]; + +Vals[0]=0xa54ff53aU; +Vals[0]+=Vals[2]; +Vals[2]+=0x08909ae5U; + +W[6]=state6; +W[6]+=Vals[3]; + +Vals[3]=0x90BB1E3CU; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=(0x9b05688cU^(Vals[0]&0xca0b3af3U)); + +Vals[7]+=state1; +Vals[3]+=Vals[7]; + +W[2]=state2; +W[2]+=Vals[6]; + +Vals[6]=0x3c6ef372U; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma2(0xbb67ae85U,Vals[2],0x6a09e667U); + +W[5]=state5; +W[5]+=Vals[4]; + +Vals[4]=0x50C6645BU; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],0x510e527fU); +Vals[4]+=W[2]; + +W[1]=Vals[7]; +Vals[7]=0xbb67ae85U; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma2(0x6a09e667U,Vals[3],Vals[2]); + +W[4]=state4; +W[4]+=Vals[1]; + +Vals[1]=0x3AC42E24U; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=W[3]; + +W[0]=Vals[5]; + +Vals[5]=Vals[1]; +Vals[5]+=0x6a09e667U; + +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[4]; +Vals[0]+=W[4]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[5]; +Vals[6]+=W[5]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[6]; +Vals[7]+=W[6]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[7]; +Vals[5]+=W[7]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=0x5807AA98U; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[9]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[10]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[11]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[12]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[13]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[14]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=0xC19BF274U; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[16]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=0x00a00000U; +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[17]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[18]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[19]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[20]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[21]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=0x00000100U; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[22]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=0x11002000U; +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[23]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]=0x80000000U; +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[24]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[25]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[26]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[27]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[28]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[29]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]=0x00400022U; +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[30]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]=0x00000100U; +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[31]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[32]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[33]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[34]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[35]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[36]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[37]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[38]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[39]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[40]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[41]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[42]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[43]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[44]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[45]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[46]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[47]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[48]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[49]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[50]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[51]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[52]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[53]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[54]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[55]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[56]; +Vals[0]+=Vals[2]; + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[57]; +Vals[3]+=Vals[6]; + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[4]+=ch(Vals[3],Vals[0],Vals[1]); +Vals[4]+=K[58]; +Vals[4]+=Vals[7]; +Vals[1]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[1]+=ch(Vals[4],Vals[3],Vals[0]); +Vals[1]+=W[11]; +Vals[1]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +Vals[1]+=W[4]; +Vals[1]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=K[59]; +Vals[1]+=Vals[5]; + +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=W[12]; +Vals[2]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +Vals[2]+=W[5]; +Vals[2]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[2]+=Vals[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#if defined(VECTORS2) || defined(VECTORS4) + if (any(Vals[2] == 0x136032edU)) { + if (Vals[2].x == 0x136032edU) + SETFOUND(nonce.x); + if (Vals[2].y == 0x136032edU) + SETFOUND(nonce.y); +#if defined(VECTORS4) + if (Vals[2].z == 0x136032edU) + SETFOUND(nonce.z); + if (Vals[2].w == 0x136032edU) + SETFOUND(nonce.w); +#endif + } +#else + if (Vals[2] == 0x136032edU) + SETFOUND(nonce); +#endif +} diff --git a/bfgminer3.9/bin/poclbm130302.cl b/bfgminer3.9/bin/poclbm130302.cl new file mode 100755 index 0000000..6f5fd01 --- /dev/null +++ b/bfgminer3.9/bin/poclbm130302.cl @@ -0,0 +1,1388 @@ +// -ck modified kernel taken from Phoenix taken from poclbm, with aspects of +// phatk and others. +// Modified version copyright 2011-2012 Con Kolivas + +// This file is taken and modified from the public-domain poclbm project, and +// we have therefore decided to keep it public-domain in Phoenix. + +#ifdef VECTORS4 + typedef uint4 u; +#elif defined VECTORS2 + typedef uint2 u; +#else + typedef uint u; +#endif + +__constant uint K[87] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, + + 0xc19bf3f4U, + 0x80000000U, + 0x00000280U, + 0x00a00055U, + 0xf377ed68U, + 0xa54ff53aU, + 0x08909ae5U, + 0x90bb1e3cU, + 0x9b05688cU, + 0xca0b3af3U, + 0x3c6ef372U, + 0xbb67ae85U, + 0x6a09e667U, + 0x50c6645bU, + 0x510e527fU, + 0x3ac42e24U, + 0x5807aa98U, + 0xc19bf274U, + 0x00a00000U, + 0x00000100U, + 0x11002000U, + 0x00400022U, + 0x136032edU +}; + +#define xc19bf3f4U K[64] +#define x80000000U K[65] +#define x00000280U K[66] +#define x00a00055U K[67] +#define xf377ed68U K[68] +#define xa54ff53aU K[69] +#define x08909ae5U K[70] +#define x90bb1e3cU K[71] +#define x9b05688cU K[72] +#define xca0b3af3U K[73] +#define x3c6ef372U K[74] +#define xbb67ae85U K[75] +#define x6a09e667U K[76] +#define x50c6645bU K[77] +#define x510e527fU K[78] +#define x3ac42e24U K[79] +#define x5807aa98U K[80] +#define xc19bf274U K[81] +#define x00a00000U K[82] +#define x00000100U K[83] +#define x11002000U K[84] +#define x00400022U K[85] +#define x136032edU K[86] + +// This part is not from the stock poclbm kernel. It's part of an optimization +// added in the Phoenix Miner. + +// Some AMD devices have a BFI_INT opcode, which behaves exactly like the +// SHA-256 ch function, but provides it in exactly one instruction. If +// detected, use it for ch. Otherwise, construct ch out of simpler logical +// primitives. + +#ifdef BITALIGN + #pragma OPENCL EXTENSION cl_amd_media_ops : enable + #define rotr(x, y) amd_bitalign((u)x, (u)x, (u)y) +#else + #define rotr(x, y) rotate((u)x, (u)(32 - y)) +#endif +#ifdef BFI_INT + // Well, slight problem... It turns out BFI_INT isn't actually exposed to + // OpenCL (or CAL IL for that matter) in any way. However, there is + // a similar instruction, BYTE_ALIGN_INT, which is exposed to OpenCL via + // amd_bytealign, takes the same inputs, and provides the same output. + // We can use that as a placeholder for BFI_INT and have the application + // patch it after compilation. + + // This is the BFI_INT function + #define ch(x, y, z) amd_bytealign(x, y, z) + + // Ma can also be implemented in terms of BFI_INT... + #define Ma(x, y, z) amd_bytealign( (z^x), (y), (x) ) + + // AMD's KernelAnalyzer throws errors compiling the kernel if we use + // amd_bytealign on constants with vectors enabled, so we use this to avoid + // problems. (this is used 4 times, and likely optimized out by the compiler.) + #define Ma2(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) +#else // BFI_INT + //GCN actually fails if manually patched with BFI_INT + + #define ch(x, y, z) bitselect((u)z, (u)y, (u)x) + #define Ma(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) + #define Ma2(x, y, z) Ma(x, y, z) +#endif + + +__kernel +__attribute__((vec_type_hint(u))) +__attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) +void search(const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + const uint b1, const uint c1, + const uint f1, const uint g1, const uint h1, +#ifndef GOFFSET + const u base, +#endif + const uint fw0, const uint fw1, const uint fw2, const uint fw3, const uint fw15, const uint fw01r, + const uint D1A, const uint C1addK5, const uint B1addK6, + const uint W16addK16, const uint W17addK17, + const uint PreVal4addT1, const uint Preval0, + volatile __global uint * output) +{ + u Vals[24]; + u *W = &Vals[8]; + +#ifdef GOFFSET + const u nonce = (uint)(get_global_id(0)); +#else + const u nonce = base + (uint)(get_global_id(0)); +#endif + +Vals[5]=Preval0; +Vals[5]+=nonce; + +Vals[0]=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],b1,c1); +Vals[0]+=D1A; + +Vals[2]=Vals[0]; +Vals[2]+=h1; + +Vals[1]=PreVal4addT1; +Vals[1]+=nonce; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); + +Vals[6]=C1addK5; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],b1); + +Vals[3]=Vals[6]; +Vals[3]+=g1; +Vals[0]+=Ma2(g1,Vals[1],f1); +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma2(f1,Vals[0],Vals[1]); + +Vals[7]=B1addK6; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); + +Vals[4]=Vals[7]; +Vals[4]+=f1; + +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[7]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[8]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[9]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[10]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[11]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[12]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[13]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[14]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=xc19bf3f4U; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=W16addK16; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=W17addK17; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]=(rotr(nonce,7)^rotr(nonce,18)^(nonce>>3U)); +W[2]+=fw2; +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[18]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]=nonce; +W[3]+=fw3; +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[19]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +W[4]+=x80000000U; +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[20]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[21]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +W[6]+=x00000280U; +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[22]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +W[7]+=fw0; +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[23]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +W[8]+=fw1; +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[24]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[25]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[26]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[27]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[28]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[29]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]=x00a00055U; +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[30]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]=fw15; +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[31]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]=fw01r; +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[32]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]=fw1; +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[33]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[34]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[35]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[36]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[37]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[38]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[39]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[40]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[41]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[42]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[43]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[44]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[45]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[46]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[47]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[48]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[49]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[50]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[51]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[52]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[53]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[54]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[55]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[56]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[57]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[58]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[59]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[60]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[61]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=W[14]; +Vals[7]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +Vals[7]+=W[7]; +Vals[7]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[62]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=W[15]; +Vals[5]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +Vals[5]+=W[8]; +Vals[5]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[63]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[5]+=state0; + +W[7]=state7; +W[7]+=Vals[2]; + +Vals[2]=xf377ed68U; +Vals[2]+=Vals[5]; +W[0]=Vals[5]; +Vals[5]=x6a09e667U; + +W[3]=state3; +W[3]+=Vals[0]; + +Vals[0]=xa54ff53aU; +Vals[0]+=Vals[2]; +Vals[2]+=x08909ae5U; + +W[6]=state6; +W[6]+=Vals[3]; + +Vals[3]=x90bb1e3cU; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=(x9b05688cU^(Vals[0]&xca0b3af3U)); + +Vals[7]+=state1; +Vals[3]+=Vals[7]; +W[1]=Vals[7]; +Vals[7]=xbb67ae85U; + +W[2]=state2; +W[2]+=Vals[6]; + +Vals[6]=x3c6ef372U; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma2(Vals[7],Vals[2],Vals[5]); + +W[5]=state5; +W[5]+=Vals[4]; + +Vals[4]=x50c6645bU; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],x510e527fU); +Vals[4]+=W[2]; + +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma2(Vals[5],Vals[3],Vals[2]); + +W[4]=state4; +W[4]+=Vals[1]; + +Vals[1]=x3ac42e24U; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=W[3]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[4]; +Vals[0]+=W[4]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[5]; +Vals[6]+=W[5]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[6]; +Vals[7]+=W[6]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[7]; +Vals[5]+=W[7]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=x5807aa98U; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[9]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[10]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[11]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[12]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[13]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[14]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=xc19bf274U; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[16]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=x00a00000U; +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[17]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[18]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[19]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[20]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[21]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=x00000100U; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[22]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=x11002000U; +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[23]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]=x80000000U; +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[24]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[25]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[26]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[27]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[28]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[29]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]=x00400022U; +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[30]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]=x00000100U; +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[31]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[32]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[33]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[34]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[35]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[36]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[37]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[38]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[39]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[40]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[41]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[42]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[43]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[44]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[45]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[46]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[47]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[48]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[49]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[50]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[51]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[52]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[53]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[54]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[55]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[56]; +Vals[0]+=Vals[2]; + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[57]; +Vals[3]+=Vals[6]; + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[4]+=ch(Vals[3],Vals[0],Vals[1]); +Vals[4]+=K[58]; +Vals[4]+=Vals[7]; +Vals[1]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[1]+=ch(Vals[4],Vals[3],Vals[0]); +Vals[1]+=W[11]; +Vals[1]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +Vals[1]+=W[4]; +Vals[1]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=K[59]; +Vals[1]+=Vals[5]; + +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=W[12]; +Vals[2]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +Vals[2]+=W[5]; +Vals[2]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[2]+=Vals[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#if defined(VECTORS2) || defined(VECTORS4) + if (any(Vals[2] == x136032edU)) { + if (Vals[2].x == x136032edU) + SETFOUND(nonce.x); + if (Vals[2].y == x136032edU) + SETFOUND(nonce.y); +#if defined(VECTORS4) + if (Vals[2].z == x136032edU) + SETFOUND(nonce.z); + if (Vals[2].w == x136032edU) + SETFOUND(nonce.w); +#endif + } +#else + if (Vals[2] == x136032edU) + SETFOUND(nonce); +#endif +} diff --git a/bfgminer3.9/bin/scrypt121016.cl b/bfgminer3.9/bin/scrypt121016.cl new file mode 100755 index 0000000..e11ab19 --- /dev/null +++ b/bfgminer3.9/bin/scrypt121016.cl @@ -0,0 +1,757 @@ +#define rotl(x,y) rotate(x,y) +#define Ch(x,y,z) bitselect(z,y,x) +#define Maj(x,y,z) Ch((x^z),y,z) + +#define EndianSwap(n) (rotl(n&0x00FF00FF,24U)|rotl(n&0xFF00FF00,8U)) + +#define Tr2(x) (rotl(x, 30U) ^ rotl(x, 19U) ^ rotl(x, 10U)) +#define Tr1(x) (rotl(x, 26U) ^ rotl(x, 21U) ^ rotl(x, 7U)) +#define Wr2(x) (rotl(x, 25U) ^ rotl(x, 14U) ^ (x>>3U)) +#define Wr1(x) (rotl(x, 15U) ^ rotl(x, 13U) ^ (x>>10U)) + +#define RND(a, b, c, d, e, f, g, h, k) \ + h += Tr1(e) + Ch(e, f, g) + k; \ + d += h; \ + h += Tr2(a) + Maj(a, b, c); + +void SHA256(uint4*restrict state0,uint4*restrict state1, const uint4 block0, const uint4 block1, const uint4 block2, const uint4 block3) +{ + uint4 S0 = *state0; + uint4 S1 = *state1; + +#define A S0.x +#define B S0.y +#define C S0.z +#define D S0.w +#define E S1.x +#define F S1.y +#define G S1.z +#define H S1.w + + uint4 W[4]; + + W[ 0].x = block0.x; + RND(A,B,C,D,E,F,G,H, W[0].x+0x428a2f98U); + W[ 0].y = block0.y; + RND(H,A,B,C,D,E,F,G, W[0].y+0x71374491U); + W[ 0].z = block0.z; + RND(G,H,A,B,C,D,E,F, W[0].z+0xb5c0fbcfU); + W[ 0].w = block0.w; + RND(F,G,H,A,B,C,D,E, W[0].w+0xe9b5dba5U); + + W[ 1].x = block1.x; + RND(E,F,G,H,A,B,C,D, W[1].x+0x3956c25bU); + W[ 1].y = block1.y; + RND(D,E,F,G,H,A,B,C, W[1].y+0x59f111f1U); + W[ 1].z = block1.z; + RND(C,D,E,F,G,H,A,B, W[1].z+0x923f82a4U); + W[ 1].w = block1.w; + RND(B,C,D,E,F,G,H,A, W[1].w+0xab1c5ed5U); + + W[ 2].x = block2.x; + RND(A,B,C,D,E,F,G,H, W[2].x+0xd807aa98U); + W[ 2].y = block2.y; + RND(H,A,B,C,D,E,F,G, W[2].y+0x12835b01U); + W[ 2].z = block2.z; + RND(G,H,A,B,C,D,E,F, W[2].z+0x243185beU); + W[ 2].w = block2.w; + RND(F,G,H,A,B,C,D,E, W[2].w+0x550c7dc3U); + + W[ 3].x = block3.x; + RND(E,F,G,H,A,B,C,D, W[3].x+0x72be5d74U); + W[ 3].y = block3.y; + RND(D,E,F,G,H,A,B,C, W[3].y+0x80deb1feU); + W[ 3].z = block3.z; + RND(C,D,E,F,G,H,A,B, W[3].z+0x9bdc06a7U); + W[ 3].w = block3.w; + RND(B,C,D,E,F,G,H,A, W[3].w+0xc19bf174U); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+0xe49b69c1U); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+0xefbe4786U); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+0x0fc19dc6U); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+0x240ca1ccU); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+0x2de92c6fU); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+0x4a7484aaU); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+0x5cb0a9dcU); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+0x76f988daU); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+0x983e5152U); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+0xa831c66dU); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+0xb00327c8U); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+0xbf597fc7U); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+0xc6e00bf3U); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+0xd5a79147U); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+0x06ca6351U); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+0x14292967U); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+0x27b70a85U); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+0x2e1b2138U); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+0x4d2c6dfcU); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+0x53380d13U); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+0x650a7354U); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+0x766a0abbU); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+0x81c2c92eU); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+0x92722c85U); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+0xa2bfe8a1U); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+0xa81a664bU); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+0xc24b8b70U); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+0xc76c51a3U); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+0xd192e819U); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+0xd6990624U); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+0xf40e3585U); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+0x106aa070U); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+0x19a4c116U); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+0x1e376c08U); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+0x2748774cU); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+0x34b0bcb5U); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+0x391c0cb3U); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+0x4ed8aa4aU); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+0x5b9cca4fU); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+0x682e6ff3U); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+0x748f82eeU); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+0x78a5636fU); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+0x84c87814U); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+0x8cc70208U); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+0x90befffaU); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+0xa4506cebU); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+0xbef9a3f7U); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+0xc67178f2U); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + + *state0 += S0; + *state1 += S1; +} + +void SHA256_fresh(uint4*restrict state0,uint4*restrict state1, const uint4 block0, const uint4 block1, const uint4 block2, const uint4 block3) +{ +#define A (*state0).x +#define B (*state0).y +#define C (*state0).z +#define D (*state0).w +#define E (*state1).x +#define F (*state1).y +#define G (*state1).z +#define H (*state1).w + + uint4 W[4]; + + W[0].x = block0.x; + D=0x98c7e2a2U+W[0].x; + H=0xfc08884dU+W[0].x; + + W[0].y = block0.y; + C=0xcd2a11aeU+Tr1(D)+Ch(D,0x510e527fU,0x9b05688cU)+W[0].y; + G=0xC3910C8EU+C+Tr2(H)+Ch(H,0xfb6feee7U,0x2a01a605U); + + W[0].z = block0.z; + B=0x0c2e12e0U+Tr1(C)+Ch(C,D,0x510e527fU)+W[0].z; + F=0x4498517BU+B+Tr2(G)+Maj(G,H,0x6a09e667U); + + W[0].w = block0.w; + A=0xa4ce148bU+Tr1(B)+Ch(B,C,D)+W[0].w; + E=0x95F61999U+A+Tr2(F)+Maj(F,G,H); + + W[1].x = block1.x; + RND(E,F,G,H,A,B,C,D, W[1].x+0x3956c25bU); + W[1].y = block1.y; + RND(D,E,F,G,H,A,B,C, W[1].y+0x59f111f1U); + W[1].z = block1.z; + RND(C,D,E,F,G,H,A,B, W[1].z+0x923f82a4U); + W[1].w = block1.w; + RND(B,C,D,E,F,G,H,A, W[1].w+0xab1c5ed5U); + + W[2].x = block2.x; + RND(A,B,C,D,E,F,G,H, W[2].x+0xd807aa98U); + W[2].y = block2.y; + RND(H,A,B,C,D,E,F,G, W[2].y+0x12835b01U); + W[2].z = block2.z; + RND(G,H,A,B,C,D,E,F, W[2].z+0x243185beU); + W[2].w = block2.w; + RND(F,G,H,A,B,C,D,E, W[2].w+0x550c7dc3U); + + W[3].x = block3.x; + RND(E,F,G,H,A,B,C,D, W[3].x+0x72be5d74U); + W[3].y = block3.y; + RND(D,E,F,G,H,A,B,C, W[3].y+0x80deb1feU); + W[3].z = block3.z; + RND(C,D,E,F,G,H,A,B, W[3].z+0x9bdc06a7U); + W[3].w = block3.w; + RND(B,C,D,E,F,G,H,A, W[3].w+0xc19bf174U); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+0xe49b69c1U); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+0xefbe4786U); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+0x0fc19dc6U); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+0x240ca1ccU); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+0x2de92c6fU); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+0x4a7484aaU); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+0x5cb0a9dcU); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+0x76f988daU); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+0x983e5152U); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+0xa831c66dU); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+0xb00327c8U); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+0xbf597fc7U); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+0xc6e00bf3U); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+0xd5a79147U); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+0x06ca6351U); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+0x14292967U); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+0x27b70a85U); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+0x2e1b2138U); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+0x4d2c6dfcU); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+0x53380d13U); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+0x650a7354U); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+0x766a0abbU); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+0x81c2c92eU); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+0x92722c85U); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+0xa2bfe8a1U); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+0xa81a664bU); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+0xc24b8b70U); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+0xc76c51a3U); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+0xd192e819U); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+0xd6990624U); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+0xf40e3585U); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+0x106aa070U); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+0x19a4c116U); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+0x1e376c08U); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+0x2748774cU); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+0x34b0bcb5U); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+0x391c0cb3U); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+0x4ed8aa4aU); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+0x5b9cca4fU); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+0x682e6ff3U); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+0x748f82eeU); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+0x78a5636fU); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+0x84c87814U); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+0x8cc70208U); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+0x90befffaU); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+0xa4506cebU); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+0xbef9a3f7U); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+0xc67178f2U); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + + *state0 += (uint4)(0x6A09E667U,0xBB67AE85U,0x3C6EF372U,0xA54FF53AU); + *state1 += (uint4)(0x510E527FU,0x9B05688CU,0x1F83D9ABU,0x5BE0CD19U); +} + +__constant uint fixedW[64] = +{ + 0x428a2f99,0xf1374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, + 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf794, + 0xf59b89c2,0x73924787,0x23c6886e,0xa42ca65c,0x15ed3627,0x4d6edcbf,0xe28217fc,0xef02488f, + 0xb707775c,0x0468c23f,0xe7e72b4c,0x49e1f1a2,0x4b99c816,0x926d1570,0xaa0fc072,0xadb36e2c, + 0xad87a3ea,0xbcb1d3a3,0x7b993186,0x562b9420,0xbff3ca0c,0xda4b0c23,0x6cd8711a,0x8f337caa, + 0xc91b1417,0xc359dce1,0xa83253a7,0x3b13c12d,0x9d3d725d,0xd9031a84,0xb1a03340,0x16f58012, + 0xe64fb6a2,0xe84d923a,0xe93a5730,0x09837686,0x078ff753,0x29833341,0xd5de0b7e,0x6948ccf4, + 0xe0a1adbe,0x7c728e11,0x511c78e4,0x315b45bd,0xfca71413,0xea28f96a,0x79703128,0x4e1ef848, +}; + +void SHA256_fixed(uint4*restrict state0,uint4*restrict state1) +{ + uint4 S0 = *state0; + uint4 S1 = *state1; + +#define A S0.x +#define B S0.y +#define C S0.z +#define D S0.w +#define E S1.x +#define F S1.y +#define G S1.z +#define H S1.w + + RND(A,B,C,D,E,F,G,H, fixedW[0]); + RND(H,A,B,C,D,E,F,G, fixedW[1]); + RND(G,H,A,B,C,D,E,F, fixedW[2]); + RND(F,G,H,A,B,C,D,E, fixedW[3]); + RND(E,F,G,H,A,B,C,D, fixedW[4]); + RND(D,E,F,G,H,A,B,C, fixedW[5]); + RND(C,D,E,F,G,H,A,B, fixedW[6]); + RND(B,C,D,E,F,G,H,A, fixedW[7]); + RND(A,B,C,D,E,F,G,H, fixedW[8]); + RND(H,A,B,C,D,E,F,G, fixedW[9]); + RND(G,H,A,B,C,D,E,F, fixedW[10]); + RND(F,G,H,A,B,C,D,E, fixedW[11]); + RND(E,F,G,H,A,B,C,D, fixedW[12]); + RND(D,E,F,G,H,A,B,C, fixedW[13]); + RND(C,D,E,F,G,H,A,B, fixedW[14]); + RND(B,C,D,E,F,G,H,A, fixedW[15]); + RND(A,B,C,D,E,F,G,H, fixedW[16]); + RND(H,A,B,C,D,E,F,G, fixedW[17]); + RND(G,H,A,B,C,D,E,F, fixedW[18]); + RND(F,G,H,A,B,C,D,E, fixedW[19]); + RND(E,F,G,H,A,B,C,D, fixedW[20]); + RND(D,E,F,G,H,A,B,C, fixedW[21]); + RND(C,D,E,F,G,H,A,B, fixedW[22]); + RND(B,C,D,E,F,G,H,A, fixedW[23]); + RND(A,B,C,D,E,F,G,H, fixedW[24]); + RND(H,A,B,C,D,E,F,G, fixedW[25]); + RND(G,H,A,B,C,D,E,F, fixedW[26]); + RND(F,G,H,A,B,C,D,E, fixedW[27]); + RND(E,F,G,H,A,B,C,D, fixedW[28]); + RND(D,E,F,G,H,A,B,C, fixedW[29]); + RND(C,D,E,F,G,H,A,B, fixedW[30]); + RND(B,C,D,E,F,G,H,A, fixedW[31]); + RND(A,B,C,D,E,F,G,H, fixedW[32]); + RND(H,A,B,C,D,E,F,G, fixedW[33]); + RND(G,H,A,B,C,D,E,F, fixedW[34]); + RND(F,G,H,A,B,C,D,E, fixedW[35]); + RND(E,F,G,H,A,B,C,D, fixedW[36]); + RND(D,E,F,G,H,A,B,C, fixedW[37]); + RND(C,D,E,F,G,H,A,B, fixedW[38]); + RND(B,C,D,E,F,G,H,A, fixedW[39]); + RND(A,B,C,D,E,F,G,H, fixedW[40]); + RND(H,A,B,C,D,E,F,G, fixedW[41]); + RND(G,H,A,B,C,D,E,F, fixedW[42]); + RND(F,G,H,A,B,C,D,E, fixedW[43]); + RND(E,F,G,H,A,B,C,D, fixedW[44]); + RND(D,E,F,G,H,A,B,C, fixedW[45]); + RND(C,D,E,F,G,H,A,B, fixedW[46]); + RND(B,C,D,E,F,G,H,A, fixedW[47]); + RND(A,B,C,D,E,F,G,H, fixedW[48]); + RND(H,A,B,C,D,E,F,G, fixedW[49]); + RND(G,H,A,B,C,D,E,F, fixedW[50]); + RND(F,G,H,A,B,C,D,E, fixedW[51]); + RND(E,F,G,H,A,B,C,D, fixedW[52]); + RND(D,E,F,G,H,A,B,C, fixedW[53]); + RND(C,D,E,F,G,H,A,B, fixedW[54]); + RND(B,C,D,E,F,G,H,A, fixedW[55]); + RND(A,B,C,D,E,F,G,H, fixedW[56]); + RND(H,A,B,C,D,E,F,G, fixedW[57]); + RND(G,H,A,B,C,D,E,F, fixedW[58]); + RND(F,G,H,A,B,C,D,E, fixedW[59]); + RND(E,F,G,H,A,B,C,D, fixedW[60]); + RND(D,E,F,G,H,A,B,C, fixedW[61]); + RND(C,D,E,F,G,H,A,B, fixedW[62]); + RND(B,C,D,E,F,G,H,A, fixedW[63]); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + *state0 += S0; + *state1 += S1; +} + +void shittify(uint4 B[8]) +{ + uint4 tmp[4]; + tmp[0] = (uint4)(B[1].x,B[2].y,B[3].z,B[0].w); + tmp[1] = (uint4)(B[2].x,B[3].y,B[0].z,B[1].w); + tmp[2] = (uint4)(B[3].x,B[0].y,B[1].z,B[2].w); + tmp[3] = (uint4)(B[0].x,B[1].y,B[2].z,B[3].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i] = EndianSwap(tmp[i]); + + tmp[0] = (uint4)(B[5].x,B[6].y,B[7].z,B[4].w); + tmp[1] = (uint4)(B[6].x,B[7].y,B[4].z,B[5].w); + tmp[2] = (uint4)(B[7].x,B[4].y,B[5].z,B[6].w); + tmp[3] = (uint4)(B[4].x,B[5].y,B[6].z,B[7].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] = EndianSwap(tmp[i]); +} + +void unshittify(uint4 B[8]) +{ + uint4 tmp[4]; + tmp[0] = (uint4)(B[3].x,B[2].y,B[1].z,B[0].w); + tmp[1] = (uint4)(B[0].x,B[3].y,B[2].z,B[1].w); + tmp[2] = (uint4)(B[1].x,B[0].y,B[3].z,B[2].w); + tmp[3] = (uint4)(B[2].x,B[1].y,B[0].z,B[3].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i] = EndianSwap(tmp[i]); + + tmp[0] = (uint4)(B[7].x,B[6].y,B[5].z,B[4].w); + tmp[1] = (uint4)(B[4].x,B[7].y,B[6].z,B[5].w); + tmp[2] = (uint4)(B[5].x,B[4].y,B[7].z,B[6].w); + tmp[3] = (uint4)(B[6].x,B[5].y,B[4].z,B[7].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] = EndianSwap(tmp[i]); +} + +void salsa(uint4 B[8]) +{ + uint4 w[4]; + +#pragma unroll + for(uint i=0; i<4; ++i) + w[i] = (B[i]^=B[i+4]); + +#pragma unroll + for(uint i=0; i<4; ++i) + { + w[0] ^= rotl(w[3] +w[2] , 7U); + w[1] ^= rotl(w[0] +w[3] , 9U); + w[2] ^= rotl(w[1] +w[0] ,13U); + w[3] ^= rotl(w[2] +w[1] ,18U); + w[2] ^= rotl(w[3].wxyz+w[0].zwxy, 7U); + w[1] ^= rotl(w[2].wxyz+w[3].zwxy, 9U); + w[0] ^= rotl(w[1].wxyz+w[2].zwxy,13U); + w[3] ^= rotl(w[0].wxyz+w[1].zwxy,18U); + } + +#pragma unroll + for(uint i=0; i<4; ++i) + w[i] = (B[i+4]^=(B[i]+=w[i])); + +#pragma unroll + for(uint i=0; i<4; ++i) + { + w[0] ^= rotl(w[3] +w[2] , 7U); + w[1] ^= rotl(w[0] +w[3] , 9U); + w[2] ^= rotl(w[1] +w[0] ,13U); + w[3] ^= rotl(w[2] +w[1] ,18U); + w[2] ^= rotl(w[3].wxyz+w[0].zwxy, 7U); + w[1] ^= rotl(w[2].wxyz+w[3].zwxy, 9U); + w[0] ^= rotl(w[1].wxyz+w[2].zwxy,13U); + w[3] ^= rotl(w[0].wxyz+w[1].zwxy,18U); + } + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] += w[i]; +} + +#define Coord(x,y,z) x+y*(x ## SIZE)+z*(y ## SIZE)*(x ## SIZE) +#define CO Coord(z,x,y) + +void scrypt_core(uint4 X[8], __global uint4*restrict lookup) +{ + shittify(X); + const uint zSIZE = 8; + const uint ySIZE = (1024/LOOKUP_GAP+(1024%LOOKUP_GAP>0)); + const uint xSIZE = CONCURRENT_THREADS; + uint x = get_global_id(0)%xSIZE; + + for(uint y=0; y<1024/LOOKUP_GAP; ++y) + { +#pragma unroll + for(uint z=0; z>3U)) +#define Wr1(x) (rotl(x, 15U) ^ rotl(x, 13U) ^ (x>>10U)) + +#define RND(a, b, c, d, e, f, g, h, k) \ + h += Tr1(e); \ + h += Ch(e, f, g); \ + h += k; \ + d += h; \ + h += Tr2(a); \ + h += Maj(a, b, c); + +void SHA256(uint4*restrict state0,uint4*restrict state1, const uint4 block0, const uint4 block1, const uint4 block2, const uint4 block3) +{ + uint4 S0 = *state0; + uint4 S1 = *state1; + +#define A S0.x +#define B S0.y +#define C S0.z +#define D S0.w +#define E S1.x +#define F S1.y +#define G S1.z +#define H S1.w + + uint4 W[4]; + + W[ 0].x = block0.x; + RND(A,B,C,D,E,F,G,H, W[0].x+ K[0]); + W[ 0].y = block0.y; + RND(H,A,B,C,D,E,F,G, W[0].y+ K[1]); + W[ 0].z = block0.z; + RND(G,H,A,B,C,D,E,F, W[0].z+ K[2]); + W[ 0].w = block0.w; + RND(F,G,H,A,B,C,D,E, W[0].w+ K[3]); + + W[ 1].x = block1.x; + RND(E,F,G,H,A,B,C,D, W[1].x+ K[4]); + W[ 1].y = block1.y; + RND(D,E,F,G,H,A,B,C, W[1].y+ K[5]); + W[ 1].z = block1.z; + RND(C,D,E,F,G,H,A,B, W[1].z+ K[6]); + W[ 1].w = block1.w; + RND(B,C,D,E,F,G,H,A, W[1].w+ K[7]); + + W[ 2].x = block2.x; + RND(A,B,C,D,E,F,G,H, W[2].x+ K[8]); + W[ 2].y = block2.y; + RND(H,A,B,C,D,E,F,G, W[2].y+ K[9]); + W[ 2].z = block2.z; + RND(G,H,A,B,C,D,E,F, W[2].z+ K[10]); + W[ 2].w = block2.w; + RND(F,G,H,A,B,C,D,E, W[2].w+ K[11]); + + W[ 3].x = block3.x; + RND(E,F,G,H,A,B,C,D, W[3].x+ K[12]); + W[ 3].y = block3.y; + RND(D,E,F,G,H,A,B,C, W[3].y+ K[13]); + W[ 3].z = block3.z; + RND(C,D,E,F,G,H,A,B, W[3].z+ K[14]); + W[ 3].w = block3.w; + RND(B,C,D,E,F,G,H,A, W[3].w+ K[76]); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[15]); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[16]); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[17]); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[18]); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[19]); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[20]); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[21]); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[22]); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[23]); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[24]); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[25]); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[26]); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[27]); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[28]); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[29]); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[30]); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[31]); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[32]); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[33]); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[34]); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[35]); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[36]); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[37]); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[38]); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[39]); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[40]); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[41]); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[42]); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[43]); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[44]); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[45]); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[46]); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[47]); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[48]); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[49]); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[50]); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[51]); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[52]); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[53]); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[54]); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[55]); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[56]); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[57]); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[58]); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[59]); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[60]); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[61]); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[62]); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + + *state0 += S0; + *state1 += S1; +} + +void SHA256_fresh(uint4*restrict state0,uint4*restrict state1, const uint4 block0, const uint4 block1, const uint4 block2, const uint4 block3) +{ +#define A (*state0).x +#define B (*state0).y +#define C (*state0).z +#define D (*state0).w +#define E (*state1).x +#define F (*state1).y +#define G (*state1).z +#define H (*state1).w + + uint4 W[4]; + + W[0].x = block0.x; + D= K[63] +W[0].x; + H= K[64] +W[0].x; + + W[0].y = block0.y; + C= K[65] +Tr1(D)+Ch(D, K[66], K[67])+W[0].y; + G= K[68] +C+Tr2(H)+Ch(H, K[69] ,K[70]); + + W[0].z = block0.z; + B= K[71] +Tr1(C)+Ch(C,D,K[66])+W[0].z; + F= K[72] +B+Tr2(G)+Maj(G,H, K[73]); + + W[0].w = block0.w; + A= K[74] +Tr1(B)+Ch(B,C,D)+W[0].w; + E= K[75] +A+Tr2(F)+Maj(F,G,H); + + W[1].x = block1.x; + RND(E,F,G,H,A,B,C,D, W[1].x+ K[4]); + W[1].y = block1.y; + RND(D,E,F,G,H,A,B,C, W[1].y+ K[5]); + W[1].z = block1.z; + RND(C,D,E,F,G,H,A,B, W[1].z+ K[6]); + W[1].w = block1.w; + RND(B,C,D,E,F,G,H,A, W[1].w+ K[7]); + + W[2].x = block2.x; + RND(A,B,C,D,E,F,G,H, W[2].x+ K[8]); + W[2].y = block2.y; + RND(H,A,B,C,D,E,F,G, W[2].y+ K[9]); + W[2].z = block2.z; + RND(G,H,A,B,C,D,E,F, W[2].z+ K[10]); + W[2].w = block2.w; + RND(F,G,H,A,B,C,D,E, W[2].w+ K[11]); + + W[3].x = block3.x; + RND(E,F,G,H,A,B,C,D, W[3].x+ K[12]); + W[3].y = block3.y; + RND(D,E,F,G,H,A,B,C, W[3].y+ K[13]); + W[3].z = block3.z; + RND(C,D,E,F,G,H,A,B, W[3].z+ K[14]); + W[3].w = block3.w; + RND(B,C,D,E,F,G,H,A, W[3].w+ K[76]); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[15]); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[16]); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[17]); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[18]); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[19]); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[20]); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[21]); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[22]); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[23]); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[24]); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[25]); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[26]); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[27]); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[28]); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[29]); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[30]); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[31]); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[32]); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[33]); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[34]); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[35]); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[36]); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[37]); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[38]); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[39]); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[40]); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[41]); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[42]); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[43]); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[44]); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[45]); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[46]); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[47]); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[48]); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[49]); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[50]); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[51]); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[52]); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[53]); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[54]); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[55]); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[56]); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[57]); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[58]); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[59]); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[60]); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[61]); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[62]); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + + *state0 += (uint4)(K[73], K[77], K[78], K[79]); + *state1 += (uint4)(K[66], K[67], K[80], K[81]); +} + +__constant uint fixedW[64] = +{ + 0x428a2f99,0xf1374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, + 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf794, + 0xf59b89c2,0x73924787,0x23c6886e,0xa42ca65c,0x15ed3627,0x4d6edcbf,0xe28217fc,0xef02488f, + 0xb707775c,0x0468c23f,0xe7e72b4c,0x49e1f1a2,0x4b99c816,0x926d1570,0xaa0fc072,0xadb36e2c, + 0xad87a3ea,0xbcb1d3a3,0x7b993186,0x562b9420,0xbff3ca0c,0xda4b0c23,0x6cd8711a,0x8f337caa, + 0xc91b1417,0xc359dce1,0xa83253a7,0x3b13c12d,0x9d3d725d,0xd9031a84,0xb1a03340,0x16f58012, + 0xe64fb6a2,0xe84d923a,0xe93a5730,0x09837686,0x078ff753,0x29833341,0xd5de0b7e,0x6948ccf4, + 0xe0a1adbe,0x7c728e11,0x511c78e4,0x315b45bd,0xfca71413,0xea28f96a,0x79703128,0x4e1ef848, +}; + +void SHA256_fixed(uint4*restrict state0,uint4*restrict state1) +{ + uint4 S0 = *state0; + uint4 S1 = *state1; + +#define A S0.x +#define B S0.y +#define C S0.z +#define D S0.w +#define E S1.x +#define F S1.y +#define G S1.z +#define H S1.w + + RND(A,B,C,D,E,F,G,H, fixedW[0]); + RND(H,A,B,C,D,E,F,G, fixedW[1]); + RND(G,H,A,B,C,D,E,F, fixedW[2]); + RND(F,G,H,A,B,C,D,E, fixedW[3]); + RND(E,F,G,H,A,B,C,D, fixedW[4]); + RND(D,E,F,G,H,A,B,C, fixedW[5]); + RND(C,D,E,F,G,H,A,B, fixedW[6]); + RND(B,C,D,E,F,G,H,A, fixedW[7]); + RND(A,B,C,D,E,F,G,H, fixedW[8]); + RND(H,A,B,C,D,E,F,G, fixedW[9]); + RND(G,H,A,B,C,D,E,F, fixedW[10]); + RND(F,G,H,A,B,C,D,E, fixedW[11]); + RND(E,F,G,H,A,B,C,D, fixedW[12]); + RND(D,E,F,G,H,A,B,C, fixedW[13]); + RND(C,D,E,F,G,H,A,B, fixedW[14]); + RND(B,C,D,E,F,G,H,A, fixedW[15]); + RND(A,B,C,D,E,F,G,H, fixedW[16]); + RND(H,A,B,C,D,E,F,G, fixedW[17]); + RND(G,H,A,B,C,D,E,F, fixedW[18]); + RND(F,G,H,A,B,C,D,E, fixedW[19]); + RND(E,F,G,H,A,B,C,D, fixedW[20]); + RND(D,E,F,G,H,A,B,C, fixedW[21]); + RND(C,D,E,F,G,H,A,B, fixedW[22]); + RND(B,C,D,E,F,G,H,A, fixedW[23]); + RND(A,B,C,D,E,F,G,H, fixedW[24]); + RND(H,A,B,C,D,E,F,G, fixedW[25]); + RND(G,H,A,B,C,D,E,F, fixedW[26]); + RND(F,G,H,A,B,C,D,E, fixedW[27]); + RND(E,F,G,H,A,B,C,D, fixedW[28]); + RND(D,E,F,G,H,A,B,C, fixedW[29]); + RND(C,D,E,F,G,H,A,B, fixedW[30]); + RND(B,C,D,E,F,G,H,A, fixedW[31]); + RND(A,B,C,D,E,F,G,H, fixedW[32]); + RND(H,A,B,C,D,E,F,G, fixedW[33]); + RND(G,H,A,B,C,D,E,F, fixedW[34]); + RND(F,G,H,A,B,C,D,E, fixedW[35]); + RND(E,F,G,H,A,B,C,D, fixedW[36]); + RND(D,E,F,G,H,A,B,C, fixedW[37]); + RND(C,D,E,F,G,H,A,B, fixedW[38]); + RND(B,C,D,E,F,G,H,A, fixedW[39]); + RND(A,B,C,D,E,F,G,H, fixedW[40]); + RND(H,A,B,C,D,E,F,G, fixedW[41]); + RND(G,H,A,B,C,D,E,F, fixedW[42]); + RND(F,G,H,A,B,C,D,E, fixedW[43]); + RND(E,F,G,H,A,B,C,D, fixedW[44]); + RND(D,E,F,G,H,A,B,C, fixedW[45]); + RND(C,D,E,F,G,H,A,B, fixedW[46]); + RND(B,C,D,E,F,G,H,A, fixedW[47]); + RND(A,B,C,D,E,F,G,H, fixedW[48]); + RND(H,A,B,C,D,E,F,G, fixedW[49]); + RND(G,H,A,B,C,D,E,F, fixedW[50]); + RND(F,G,H,A,B,C,D,E, fixedW[51]); + RND(E,F,G,H,A,B,C,D, fixedW[52]); + RND(D,E,F,G,H,A,B,C, fixedW[53]); + RND(C,D,E,F,G,H,A,B, fixedW[54]); + RND(B,C,D,E,F,G,H,A, fixedW[55]); + RND(A,B,C,D,E,F,G,H, fixedW[56]); + RND(H,A,B,C,D,E,F,G, fixedW[57]); + RND(G,H,A,B,C,D,E,F, fixedW[58]); + RND(F,G,H,A,B,C,D,E, fixedW[59]); + RND(E,F,G,H,A,B,C,D, fixedW[60]); + RND(D,E,F,G,H,A,B,C, fixedW[61]); + RND(C,D,E,F,G,H,A,B, fixedW[62]); + RND(B,C,D,E,F,G,H,A, fixedW[63]); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + *state0 += S0; + *state1 += S1; +} + +void shittify(uint4 B[8]) +{ + uint4 tmp[4]; + tmp[0] = (uint4)(B[1].x,B[2].y,B[3].z,B[0].w); + tmp[1] = (uint4)(B[2].x,B[3].y,B[0].z,B[1].w); + tmp[2] = (uint4)(B[3].x,B[0].y,B[1].z,B[2].w); + tmp[3] = (uint4)(B[0].x,B[1].y,B[2].z,B[3].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i] = EndianSwap(tmp[i]); + + tmp[0] = (uint4)(B[5].x,B[6].y,B[7].z,B[4].w); + tmp[1] = (uint4)(B[6].x,B[7].y,B[4].z,B[5].w); + tmp[2] = (uint4)(B[7].x,B[4].y,B[5].z,B[6].w); + tmp[3] = (uint4)(B[4].x,B[5].y,B[6].z,B[7].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] = EndianSwap(tmp[i]); +} + +void unshittify(uint4 B[8]) +{ + uint4 tmp[4]; + tmp[0] = (uint4)(B[3].x,B[2].y,B[1].z,B[0].w); + tmp[1] = (uint4)(B[0].x,B[3].y,B[2].z,B[1].w); + tmp[2] = (uint4)(B[1].x,B[0].y,B[3].z,B[2].w); + tmp[3] = (uint4)(B[2].x,B[1].y,B[0].z,B[3].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i] = EndianSwap(tmp[i]); + + tmp[0] = (uint4)(B[7].x,B[6].y,B[5].z,B[4].w); + tmp[1] = (uint4)(B[4].x,B[7].y,B[6].z,B[5].w); + tmp[2] = (uint4)(B[5].x,B[4].y,B[7].z,B[6].w); + tmp[3] = (uint4)(B[6].x,B[5].y,B[4].z,B[7].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] = EndianSwap(tmp[i]); +} + +void salsa(uint4 B[8]) +{ + uint4 w[4]; + +#pragma unroll + for(uint i=0; i<4; ++i) + w[i] = (B[i]^=B[i+4]); + +#pragma unroll + for(uint i=0; i<4; ++i) + { + w[0] ^= rotl(w[3] +w[2] , 7U); + w[1] ^= rotl(w[0] +w[3] , 9U); + w[2] ^= rotl(w[1] +w[0] ,13U); + w[3] ^= rotl(w[2] +w[1] ,18U); + w[2] ^= rotl(w[3].wxyz+w[0].zwxy, 7U); + w[1] ^= rotl(w[2].wxyz+w[3].zwxy, 9U); + w[0] ^= rotl(w[1].wxyz+w[2].zwxy,13U); + w[3] ^= rotl(w[0].wxyz+w[1].zwxy,18U); + } + +#pragma unroll + for(uint i=0; i<4; ++i) + w[i] = (B[i+4]^=(B[i]+=w[i])); + +#pragma unroll + for(uint i=0; i<4; ++i) + { + w[0] ^= rotl(w[3] +w[2] , 7U); + w[1] ^= rotl(w[0] +w[3] , 9U); + w[2] ^= rotl(w[1] +w[0] ,13U); + w[3] ^= rotl(w[2] +w[1] ,18U); + w[2] ^= rotl(w[3].wxyz+w[0].zwxy, 7U); + w[1] ^= rotl(w[2].wxyz+w[3].zwxy, 9U); + w[0] ^= rotl(w[1].wxyz+w[2].zwxy,13U); + w[3] ^= rotl(w[0].wxyz+w[1].zwxy,18U); + } + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] += w[i]; +} + +#define Coord(x,y,z) x+y*(x ## SIZE)+z*(y ## SIZE)*(x ## SIZE) +#define CO Coord(z,x,y) + +void scrypt_core(uint4 X[8], __global uint4*restrict lookup) +{ + shittify(X); + const uint zSIZE = 8; + const uint ySIZE = (1024/LOOKUP_GAP+(1024%LOOKUP_GAP>0)); + const uint xSIZE = CONCURRENT_THREADS; + uint x = get_global_id(0)%xSIZE; + + for(uint y=0; y<1024/LOOKUP_GAP; ++y) + { +#pragma unroll + for(uint z=0; z + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef JANSSON_H +#define JANSSON_H + +#include +#include /* for size_t */ +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* version */ + +#define JANSSON_MAJOR_VERSION 2 +#define JANSSON_MINOR_VERSION 5 +#define JANSSON_MICRO_VERSION 0 + +/* Micro version is omitted if it's 0 */ +#define JANSSON_VERSION "2.5" + +/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this + for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */ +#define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \ + (JANSSON_MINOR_VERSION << 8) | \ + (JANSSON_MICRO_VERSION << 0)) + + +/* types */ + +typedef enum { + JSON_OBJECT, + JSON_ARRAY, + JSON_STRING, + JSON_INTEGER, + JSON_REAL, + JSON_TRUE, + JSON_FALSE, + JSON_NULL +} json_type; + +typedef struct json_t { + json_type type; + size_t refcount; +} json_t; + +#ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ +#if JSON_INTEGER_IS_LONG_LONG +#ifdef _WIN32 +#define JSON_INTEGER_FORMAT "I64d" +#else +#define JSON_INTEGER_FORMAT "lld" +#endif +typedef long long json_int_t; +#else +#define JSON_INTEGER_FORMAT "ld" +typedef long json_int_t; +#endif /* JSON_INTEGER_IS_LONG_LONG */ +#endif + +#define json_typeof(json) ((json)->type) +#define json_is_object(json) (json && json_typeof(json) == JSON_OBJECT) +#define json_is_array(json) (json && json_typeof(json) == JSON_ARRAY) +#define json_is_string(json) (json && json_typeof(json) == JSON_STRING) +#define json_is_integer(json) (json && json_typeof(json) == JSON_INTEGER) +#define json_is_real(json) (json && json_typeof(json) == JSON_REAL) +#define json_is_number(json) (json_is_integer(json) || json_is_real(json)) +#define json_is_true(json) (json && json_typeof(json) == JSON_TRUE) +#define json_is_false(json) (json && json_typeof(json) == JSON_FALSE) +#define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) +#define json_is_null(json) (json && json_typeof(json) == JSON_NULL) + +/* construction, destruction, reference counting */ + +json_t *json_object(void); +json_t *json_array(void); +json_t *json_string(const char *value); +json_t *json_string_nocheck(const char *value); +json_t *json_integer(json_int_t value); +json_t *json_real(double value); +json_t *json_true(void); +json_t *json_false(void); +#define json_boolean(val) ((val) ? json_true() : json_false()) +json_t *json_null(void); + +static JSON_INLINE +json_t *json_incref(json_t *json) +{ + if(json && json->refcount != (size_t)-1) + ++json->refcount; + return json; +} + +/* do not call json_delete directly */ +void json_delete(json_t *json); + +static JSON_INLINE +void json_decref(json_t *json) +{ + if(json && json->refcount != (size_t)-1 && --json->refcount == 0) + json_delete(json); +} + + +/* error reporting */ + +#define JSON_ERROR_TEXT_LENGTH 160 +#define JSON_ERROR_SOURCE_LENGTH 80 + +typedef struct { + int line; + int column; + int position; + char source[JSON_ERROR_SOURCE_LENGTH]; + char text[JSON_ERROR_TEXT_LENGTH]; +} json_error_t; + + +/* getters, setters, manipulation */ + +size_t json_object_size(const json_t *object); +json_t *json_object_get(const json_t *object, const char *key); +int json_object_set_new(json_t *object, const char *key, json_t *value); +int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value); +int json_object_del(json_t *object, const char *key); +int json_object_clear(json_t *object); +int json_object_update(json_t *object, json_t *other); +int json_object_update_existing(json_t *object, json_t *other); +int json_object_update_missing(json_t *object, json_t *other); +void *json_object_iter(json_t *object); +void *json_object_iter_at(json_t *object, const char *key); +void *json_object_key_to_iter(const char *key); +void *json_object_iter_next(json_t *object, void *iter); +const char *json_object_iter_key(void *iter); +json_t *json_object_iter_value(void *iter); +int json_object_iter_set_new(json_t *object, void *iter, json_t *value); + +#define json_object_foreach(object, key, value) \ + for(key = json_object_iter_key(json_object_iter(object)); \ + key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ + key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key)))) + +#define json_array_foreach(array, index, value) \ + for(index = 0; \ + index < json_array_size(array) && (value = json_array_get(array, index)); \ + index++) + +static JSON_INLINE +int json_object_set(json_t *object, const char *key, json_t *value) +{ + return json_object_set_new(object, key, json_incref(value)); +} + +static JSON_INLINE +int json_object_set_nocheck(json_t *object, const char *key, json_t *value) +{ + return json_object_set_new_nocheck(object, key, json_incref(value)); +} + +static JSON_INLINE +int json_object_iter_set(json_t *object, void *iter, json_t *value) +{ + return json_object_iter_set_new(object, iter, json_incref(value)); +} + +size_t json_array_size(const json_t *array); +json_t *json_array_get(const json_t *array, size_t index); +int json_array_set_new(json_t *array, size_t index, json_t *value); +int json_array_append_new(json_t *array, json_t *value); +int json_array_insert_new(json_t *array, size_t index, json_t *value); +int json_array_remove(json_t *array, size_t index); +int json_array_clear(json_t *array); +int json_array_extend(json_t *array, json_t *other); + +static JSON_INLINE +int json_array_set(json_t *array, size_t ind, json_t *value) +{ + return json_array_set_new(array, ind, json_incref(value)); +} + +static JSON_INLINE +int json_array_append(json_t *array, json_t *value) +{ + return json_array_append_new(array, json_incref(value)); +} + +static JSON_INLINE +int json_array_insert(json_t *array, size_t ind, json_t *value) +{ + return json_array_insert_new(array, ind, json_incref(value)); +} + +const char *json_string_value(const json_t *string); +json_int_t json_integer_value(const json_t *integer); +double json_real_value(const json_t *real); +double json_number_value(const json_t *json); + +int json_string_set(json_t *string, const char *value); +int json_string_set_nocheck(json_t *string, const char *value); +int json_integer_set(json_t *integer, json_int_t value); +int json_real_set(json_t *real, double value); + + +/* pack, unpack */ + +json_t *json_pack(const char *fmt, ...); +json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...); +json_t *json_vpack_ex(json_error_t *error, size_t flags, const char *fmt, va_list ap); + +#define JSON_VALIDATE_ONLY 0x1 +#define JSON_STRICT 0x2 + +int json_unpack(json_t *root, const char *fmt, ...); +int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...); +int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, va_list ap); + + +/* equality */ + +int json_equal(json_t *value1, json_t *value2); + + +/* copying */ + +json_t *json_copy(json_t *value); +json_t *json_deep_copy(const json_t *value); + + +/* decoding */ + +#define JSON_REJECT_DUPLICATES 0x1 +#define JSON_DISABLE_EOF_CHECK 0x2 +#define JSON_DECODE_ANY 0x4 +#define JSON_DECODE_INT_AS_REAL 0x8 + +typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data); + +json_t *json_loads(const char *input, size_t flags, json_error_t *error); +json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error); +json_t *json_loadf(FILE *input, size_t flags, json_error_t *error); +json_t *json_load_file(const char *path, size_t flags, json_error_t *error); +json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error); + + +/* encoding */ + +#define JSON_INDENT(n) (n & 0x1F) +#define JSON_COMPACT 0x20 +#define JSON_ENSURE_ASCII 0x40 +#define JSON_SORT_KEYS 0x80 +#define JSON_PRESERVE_ORDER 0x100 +#define JSON_ENCODE_ANY 0x200 +#define JSON_ESCAPE_SLASH 0x400 + +typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data); + +char *json_dumps(const json_t *json, size_t flags); +int json_dumpf(const json_t *json, FILE *output, size_t flags); +int json_dump_file(const json_t *json, const char *path, size_t flags); +int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags); + +/* custom memory allocation */ + +typedef void *(*json_malloc_t)(size_t); +typedef void (*json_free_t)(void *); + +void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bfgminer3.9/include/jansson_config.h b/bfgminer3.9/include/jansson_config.h new file mode 100644 index 0000000..447730f --- /dev/null +++ b/bfgminer3.9/include/jansson_config.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + * + * + * This file specifies a part of the site-specific configuration for + * Jansson, namely those things that affect the public API in + * jansson.h. + * + * The configure script copies this file to jansson_config.h and + * replaces @var@ substitutions by values that fit your system. If you + * cannot run the configure script, you can do the value substitution + * by hand. + */ + +#ifndef JANSSON_CONFIG_H +#define JANSSON_CONFIG_H + +/* If your compiler supports the inline keyword in C, JSON_INLINE is + defined to `inline', otherwise empty. In C++, the inline is always + supported. */ +#ifdef __cplusplus +#define JSON_INLINE inline +#else +#define JSON_INLINE inline +#endif + +/* If your compiler supports the `long long` type and the strtoll() + library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, + otherwise to 0. */ +#define JSON_INTEGER_IS_LONG_LONG 1 + +/* If locale.h and localeconv() are available, define to 1, + otherwise to 0. */ +#define JSON_HAVE_LOCALECONV 1 + +#endif diff --git a/bfgminer3.9/include/libblkmaker-0.1/blkmaker.h b/bfgminer3.9/include/libblkmaker-0.1/blkmaker.h new file mode 100644 index 0000000..83b6025 --- /dev/null +++ b/bfgminer3.9/include/libblkmaker-0.1/blkmaker.h @@ -0,0 +1,26 @@ +#ifndef BLKMAKER_H +#define BLKMAKER_H + +#include +#include +#include + +#include + +#define BLKMAKER_VERSION (4L) +#define BLKMAKER_MAX_BLOCK_VERSION (2) + +extern bool (*blkmk_sha256_impl)(void *hash_out, const void *data, size_t datasz); + +extern uint64_t blkmk_init_generation(blktemplate_t *, void *script, size_t scriptsz); +extern uint64_t blkmk_init_generation2(blktemplate_t *, void *script, size_t scriptsz, bool *out_newcb); +extern ssize_t blkmk_append_coinbase_safe(blktemplate_t *, const void *append, size_t appendsz); +extern bool _blkmk_extranonce(blktemplate_t *tmpl, void *vout, unsigned int workid, size_t *offs); +extern size_t blkmk_get_data(blktemplate_t *, void *buf, size_t bufsz, time_t usetime, int16_t *out_expire, unsigned int *out_dataid); +extern blktime_diff_t blkmk_time_left(const blktemplate_t *, time_t nowtime); +extern unsigned long blkmk_work_left(const blktemplate_t *); +#define BLKMK_UNLIMITED_WORK_COUNT ULONG_MAX + +extern size_t blkmk_address_to_script(void *out, size_t outsz, const char *addr); + +#endif diff --git a/bfgminer3.9/include/libblkmaker-0.1/blkmaker_jansson.h b/bfgminer3.9/include/libblkmaker-0.1/blkmaker_jansson.h new file mode 100644 index 0000000..0345cff --- /dev/null +++ b/bfgminer3.9/include/libblkmaker-0.1/blkmaker_jansson.h @@ -0,0 +1,13 @@ +#ifndef BLKMAKER_JANSSON_H +#define BLKMAKER_JANSSON_H + +#include + +#include + +extern json_t *blktmpl_request_jansson(gbt_capabilities_t extracaps, const char *lpid); +extern const char *blktmpl_add_jansson(blktemplate_t *, const json_t *, time_t time_rcvd); +extern json_t *blkmk_submit_jansson(blktemplate_t *, const unsigned char *data, unsigned int dataid, blknonce_t); +extern json_t *blkmk_submit_foreign_jansson(blktemplate_t *, const unsigned char *data, unsigned int dataid, blknonce_t); + +#endif diff --git a/bfgminer3.9/include/libblkmaker-0.1/blktemplate.h b/bfgminer3.9/include/libblkmaker-0.1/blktemplate.h new file mode 100644 index 0000000..e9747b7 --- /dev/null +++ b/bfgminer3.9/include/libblkmaker-0.1/blktemplate.h @@ -0,0 +1,130 @@ +/* + * Copyright 2012 Luke Dashjr + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the standard MIT license. See COPYING for more details. + */ + +#ifndef BLKTEMPLATE_H +#define BLKTEMPLATE_H + +#include +#include +#include + +typedef uint32_t blkheight_t; +typedef uint32_t libblkmaker_hash_t[8]; +typedef libblkmaker_hash_t blkhash_t; +typedef libblkmaker_hash_t txnhash_t; +typedef uint32_t blktime_t; +typedef int16_t blktime_diff_t; +typedef uint32_t blknonce_t; + +struct blktxn_t { + unsigned char *data; + size_t datasz; + txnhash_t *hash; + + signed long dependcount; + unsigned long *depends; + + uint64_t fee; + bool required; + int16_t sigops; +}; + +// BIP 23: Long Polling +struct blktmpl_longpoll_req { + char *id; + char *uri; +}; + + +typedef enum { + GBT_CBTXN = 1 << 0, + GBT_CBVALUE = 1 << 1, + GBT_WORKID = 1 << 2, + + GBT_LONGPOLL = 1 << 3, // BIP 22: Long Polling + GBT_PROPOSAL = 1 << 4, // BIP 23: Block Proposal + GBT_SERVICE = 1 << 5, // BIP 23: Logical Services + + // BIP 23: Mutations + BMM_CBAPPEND = 1 << 0x10, + BMM_CBSET = 1 << 0x11, + BMM_GENERATE = 1 << 0x12, + BMM_TIMEINC = 1 << 0x13, + BMM_TIMEDEC = 1 << 0x14, + BMM_TXNADD = 1 << 0x15, + BMM_PREVBLK = 1 << 0x16, + BMM_VERFORCE = 1 << 0x17, + BMM_VERDROP = 1 << 0x18, + + // BIP 23: Submission Abbreviation + BMA_TXNHASH = 1 << 0x19, + BMAb_COINBASE = 1 << 0x1a, + BMAb_TRUNCATE = 1 << 0x1b, + BMAs_COINBASE = 1 << 0x1c, + BMAs_MERKLE = 1 << 0x1d, + BMAs_TRUNCATE = 1 << 0x1e, +} gbt_capabilities_t; +#define GBT_CAPABILITY_COUNT (0x1f) + +extern const char *blktmpl_capabilityname(gbt_capabilities_t); +#define BLKTMPL_LONGEST_CAPABILITY_NAME (16) +extern gbt_capabilities_t blktmpl_getcapability(const char *); + + +typedef gbt_capabilities_t blkmutations_t; + +typedef struct { + uint32_t version; + unsigned char diffbits[4]; + blkheight_t height; + blkhash_t prevblk; + + unsigned short sigoplimit; + unsigned long sizelimit; + + unsigned long txncount; + struct blktxn_t *txns; + struct blktxn_t *cbtxn; + uint64_t cbvalue; + + time_t _time_rcvd; + blktime_t curtime; + char auxcount; + char **auxnames; + unsigned char **auxdata; + + char *workid; + + // BIP 22: Long Polling + struct blktmpl_longpoll_req lp; + bool submitold; + + // BIP 23: Basic Pool Extensions + int16_t expires; + blkhash_t target; + + // BIP 23: Mutations + blkmutations_t mutations; + blktime_t maxtime; + blktime_diff_t maxtimeoff; + blktime_t mintime; + blktime_diff_t mintimeoff; + blknonce_t minnonce; + blknonce_t maxnonce; + + // TEMPORARY HACK + libblkmaker_hash_t _mrklroot; + unsigned int next_dataid; +} blktemplate_t; + +extern blktemplate_t *blktmpl_create(); +extern gbt_capabilities_t blktmpl_addcaps(const blktemplate_t *); +extern const struct blktmpl_longpoll_req *blktmpl_get_longpoll(blktemplate_t *); +extern bool blktmpl_get_submitold(blktemplate_t *tmpl); +extern void blktmpl_free(blktemplate_t *); + +#endif diff --git a/bfgminer3.9/include/libusb-1.0/libusb.h b/bfgminer3.9/include/libusb-1.0/libusb.h new file mode 100644 index 0000000..f3a8f38 --- /dev/null +++ b/bfgminer3.9/include/libusb-1.0/libusb.h @@ -0,0 +1,1779 @@ +/* + * Public libusb header file + * Copyright (C) 2007-2008 Daniel Drake + * Copyright (c) 2001 Johannes Erdfelt + * Copyright (C) 2012-2013 Nathan Hjelm + * Copyright (C) 2012 Peter Stuge + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LIBUSB_H +#define LIBUSB_H + +#ifdef _MSC_VER +/* on MS environments, the inline keyword is available in C++ only */ +#define inline __inline +/* ssize_t is also not available (copy/paste from MinGW) */ +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 + typedef __int64 ssize_t; +#else + typedef int ssize_t; +#endif /* _WIN64 */ +#endif /* _SSIZE_T_DEFINED */ +#endif /* _MSC_VER */ + +/* stdint.h is also not usually available on MS */ +#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H)) +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +#else +#include +#endif + +#include +#include +#include + +#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__) +#include +#endif + +/* 'interface' might be defined as a macro on Windows, so we need to + * undefine it so as not to break the current libusb API, because + * libusb_config_descriptor has an 'interface' member + * As this can be problematic if you include windows.h after libusb.h + * in your sources, we force windows.h to be included first. */ +#if defined(_WIN32) || defined(__CYGWIN__) +#include +#if defined(interface) +#undef interface +#endif +#endif + +/** \def LIBUSB_CALL + * \ingroup misc + * libusb's Windows calling convention. + * + * Under Windows, the selection of available compilers and configurations + * means that, unlike other platforms, there is not one true calling + * convention (calling convention: the manner in which parameters are + * passed to funcions in the generated assembly code). + * + * Matching the Windows API itself, libusb uses the WINAPI convention (which + * translates to the stdcall convention) and guarantees that the + * library is compiled in this way. The public header file also includes + * appropriate annotations so that your own software will use the right + * convention, even if another convention is being used by default within + * your codebase. + * + * The one consideration that you must apply in your software is to mark + * all functions which you use as libusb callbacks with this LIBUSB_CALL + * annotation, so that they too get compiled for the correct calling + * convention. + * + * On non-Windows operating systems, this macro is defined as nothing. This + * means that you can apply it to your code without worrying about + * cross-platform compatibility. + */ +/* LIBUSB_CALL must be defined on both definition and declaration of libusb + * functions. You'd think that declaration would be enough, but cygwin will + * complain about conflicting types unless both are marked this way. + * The placement of this macro is important too; it must appear after the + * return type, before the function name. See internal documentation for + * API_EXPORTED. + */ +#if defined(_WIN32) || defined(__CYGWIN__) +#define LIBUSB_CALL WINAPI +#else +#define LIBUSB_CALL +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** \def libusb_cpu_to_le16 + * \ingroup misc + * Convert a 16-bit value from host-endian to little-endian format. On + * little endian systems, this function does nothing. On big endian systems, + * the bytes are swapped. + * \param x the host-endian value to convert + * \returns the value in little-endian byte order + */ +static inline uint16_t libusb_cpu_to_le16(const uint16_t x) +{ + union { + uint8_t b8[2]; + uint16_t b16; + } _tmp; + _tmp.b8[1] = x >> 8; + _tmp.b8[0] = x & 0xff; + return _tmp.b16; +} + +/** \def libusb_le16_to_cpu + * \ingroup misc + * Convert a 16-bit value from little-endian to host-endian format. On + * little endian systems, this function does nothing. On big endian systems, + * the bytes are swapped. + * \param x the little-endian value to convert + * \returns the value in host-endian byte order + */ +#define libusb_le16_to_cpu libusb_cpu_to_le16 + +/* standard USB stuff */ + +/** \ingroup desc + * Device and/or Interface Class codes */ +enum libusb_class_code { + /** In the context of a \ref libusb_device_descriptor "device descriptor", + * this bDeviceClass value indicates that each interface specifies its + * own class information and all interfaces operate independently. + */ + LIBUSB_CLASS_PER_INTERFACE = 0, + + /** Audio class */ + LIBUSB_CLASS_AUDIO = 1, + + /** Communications class */ + LIBUSB_CLASS_COMM = 2, + + /** Human Interface Device class */ + LIBUSB_CLASS_HID = 3, + + /** Physical */ + LIBUSB_CLASS_PHYSICAL = 5, + + /** Printer class */ + LIBUSB_CLASS_PRINTER = 7, + + /** Image class */ + LIBUSB_CLASS_PTP = 6, /* legacy name from libusb-0.1 usb.h */ + LIBUSB_CLASS_IMAGE = 6, + + /** Mass storage class */ + LIBUSB_CLASS_MASS_STORAGE = 8, + + /** Hub class */ + LIBUSB_CLASS_HUB = 9, + + /** Data class */ + LIBUSB_CLASS_DATA = 10, + + /** Smart Card */ + LIBUSB_CLASS_SMART_CARD = 0x0b, + + /** Content Security */ + LIBUSB_CLASS_CONTENT_SECURITY = 0x0d, + + /** Video */ + LIBUSB_CLASS_VIDEO = 0x0e, + + /** Personal Healthcare */ + LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f, + + /** Diagnostic Device */ + LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc, + + /** Wireless class */ + LIBUSB_CLASS_WIRELESS = 0xe0, + + /** Application class */ + LIBUSB_CLASS_APPLICATION = 0xfe, + + /** Class is vendor-specific */ + LIBUSB_CLASS_VENDOR_SPEC = 0xff +}; + +/** \ingroup desc + * Descriptor types as defined by the USB specification. */ +enum libusb_descriptor_type { + /** Device descriptor. See libusb_device_descriptor. */ + LIBUSB_DT_DEVICE = 0x01, + + /** Configuration descriptor. See libusb_config_descriptor. */ + LIBUSB_DT_CONFIG = 0x02, + + /** String descriptor */ + LIBUSB_DT_STRING = 0x03, + + /** Interface descriptor. See libusb_interface_descriptor. */ + LIBUSB_DT_INTERFACE = 0x04, + + /** Endpoint descriptor. See libusb_endpoint_descriptor. */ + LIBUSB_DT_ENDPOINT = 0x05, + + /** HID descriptor */ + LIBUSB_DT_HID = 0x21, + + /** HID report descriptor */ + LIBUSB_DT_REPORT = 0x22, + + /** Physical descriptor */ + LIBUSB_DT_PHYSICAL = 0x23, + + /** Hub descriptor */ + LIBUSB_DT_HUB = 0x29, + + /** BOS descriptor */ + LIBUSB_DT_BOS = 0x0f, + + /** Device Capability descriptor */ + LIBUSB_DT_DEVICE_CAPABILITY = 0x10, + + /** SuperSpeed Endpoint Companion descriptor */ + LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30 +}; + +/* Descriptor sizes per descriptor type */ +#define LIBUSB_DT_DEVICE_SIZE 18 +#define LIBUSB_DT_CONFIG_SIZE 9 +#define LIBUSB_DT_INTERFACE_SIZE 9 +#define LIBUSB_DT_ENDPOINT_SIZE 7 +#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ +#define LIBUSB_DT_HUB_NONVAR_SIZE 7 +#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6 +#define LIBUSB_DT_BOS_SIZE 5 +#define LIBUSB_USB_2_0_EXTENSION_DEVICE_CAPABILITY_SIZE 7 +#define LIBUSB_SS_USB_DEVICE_CAPABILITY_SIZE 10 +#define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) + \ + (LIBUSB_USB_2_0_EXTENSION_DEVICE_CAPABILITY_SIZE) + \ + (LIBUSB_SS_USB_DEVICE_CAPABILITY_SIZE)) + +#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ +#define LIBUSB_ENDPOINT_DIR_MASK 0x80 + +/** \ingroup desc + * Endpoint direction. Values for bit 7 of the + * \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme. + */ +enum libusb_endpoint_direction { + /** In: device-to-host */ + LIBUSB_ENDPOINT_IN = 0x80, + + /** Out: host-to-device */ + LIBUSB_ENDPOINT_OUT = 0x00 +}; + +#define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */ + +/** \ingroup desc + * Endpoint transfer type. Values for bits 0:1 of the + * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field. + */ +enum libusb_transfer_type { + /** Control endpoint */ + LIBUSB_TRANSFER_TYPE_CONTROL = 0, + + /** Isochronous endpoint */ + LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1, + + /** Bulk endpoint */ + LIBUSB_TRANSFER_TYPE_BULK = 2, + + /** Interrupt endpoint */ + LIBUSB_TRANSFER_TYPE_INTERRUPT = 3 +}; + +/** \ingroup misc + * Standard requests, as defined in table 9-3 of the USB2 specifications */ +enum libusb_standard_request { + /** Request status of the specific recipient */ + LIBUSB_REQUEST_GET_STATUS = 0x00, + + /** Clear or disable a specific feature */ + LIBUSB_REQUEST_CLEAR_FEATURE = 0x01, + + /* 0x02 is reserved */ + + /** Set or enable a specific feature */ + LIBUSB_REQUEST_SET_FEATURE = 0x03, + + /* 0x04 is reserved */ + + /** Set device address for all future accesses */ + LIBUSB_REQUEST_SET_ADDRESS = 0x05, + + /** Get the specified descriptor */ + LIBUSB_REQUEST_GET_DESCRIPTOR = 0x06, + + /** Used to update existing descriptors or add new descriptors */ + LIBUSB_REQUEST_SET_DESCRIPTOR = 0x07, + + /** Get the current device configuration value */ + LIBUSB_REQUEST_GET_CONFIGURATION = 0x08, + + /** Set device configuration */ + LIBUSB_REQUEST_SET_CONFIGURATION = 0x09, + + /** Return the selected alternate setting for the specified interface */ + LIBUSB_REQUEST_GET_INTERFACE = 0x0A, + + /** Select an alternate interface for the specified interface */ + LIBUSB_REQUEST_SET_INTERFACE = 0x0B, + + /** Set then report an endpoint's synchronization frame */ + LIBUSB_REQUEST_SYNCH_FRAME = 0x0C, +}; + +/** \ingroup misc + * Request type bits of the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control + * transfers. */ +enum libusb_request_type { + /** Standard */ + LIBUSB_REQUEST_TYPE_STANDARD = (0x00 << 5), + + /** Class */ + LIBUSB_REQUEST_TYPE_CLASS = (0x01 << 5), + + /** Vendor */ + LIBUSB_REQUEST_TYPE_VENDOR = (0x02 << 5), + + /** Reserved */ + LIBUSB_REQUEST_TYPE_RESERVED = (0x03 << 5) +}; + +/** \ingroup misc + * Recipient bits of the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control + * transfers. Values 4 through 31 are reserved. */ +enum libusb_request_recipient { + /** Device */ + LIBUSB_RECIPIENT_DEVICE = 0x00, + + /** Interface */ + LIBUSB_RECIPIENT_INTERFACE = 0x01, + + /** Endpoint */ + LIBUSB_RECIPIENT_ENDPOINT = 0x02, + + /** Other */ + LIBUSB_RECIPIENT_OTHER = 0x03, +}; + +#define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C + +/** \ingroup desc + * Synchronization type for isochronous endpoints. Values for bits 2:3 of the + * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in + * libusb_endpoint_descriptor. + */ +enum libusb_iso_sync_type { + /** No synchronization */ + LIBUSB_ISO_SYNC_TYPE_NONE = 0, + + /** Asynchronous */ + LIBUSB_ISO_SYNC_TYPE_ASYNC = 1, + + /** Adaptive */ + LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 2, + + /** Synchronous */ + LIBUSB_ISO_SYNC_TYPE_SYNC = 3 +}; + +#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30 + +/** \ingroup desc + * Usage type for isochronous endpoints. Values for bits 4:5 of the + * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in + * libusb_endpoint_descriptor. + */ +enum libusb_iso_usage_type { + /** Data endpoint */ + LIBUSB_ISO_USAGE_TYPE_DATA = 0, + + /** Feedback endpoint */ + LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 1, + + /** Implicit feedback Data endpoint */ + LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 2, +}; + +/** \ingroup desc + * A structure representing the standard USB device descriptor. This + * descriptor is documented in section 9.6.1 of the USB 2.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_device_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE LIBUSB_DT_DEVICE in this + * context. */ + uint8_t bDescriptorType; + + /** USB specification release number in binary-coded decimal. A value of + * 0x0200 indicates USB 2.0, 0x0110 indicates USB 1.1, etc. */ + uint16_t bcdUSB; + + /** USB-IF class code for the device. See \ref libusb_class_code. */ + uint8_t bDeviceClass; + + /** USB-IF subclass code for the device, qualified by the bDeviceClass + * value */ + uint8_t bDeviceSubClass; + + /** USB-IF protocol code for the device, qualified by the bDeviceClass and + * bDeviceSubClass values */ + uint8_t bDeviceProtocol; + + /** Maximum packet size for endpoint 0 */ + uint8_t bMaxPacketSize0; + + /** USB-IF vendor ID */ + uint16_t idVendor; + + /** USB-IF product ID */ + uint16_t idProduct; + + /** Device release number in binary-coded decimal */ + uint16_t bcdDevice; + + /** Index of string descriptor describing manufacturer */ + uint8_t iManufacturer; + + /** Index of string descriptor describing product */ + uint8_t iProduct; + + /** Index of string descriptor containing device serial number */ + uint8_t iSerialNumber; + + /** Number of possible configurations */ + uint8_t bNumConfigurations; +}; + +/** \ingroup desc + * A structure representing the superspeed endpoint companion + * descriptor. This descriptor is documented in section 9.6.7 of + * the USB 3.0 specification. All ultiple-byte fields are represented in + * host-endian format. + */ +struct libusb_ss_endpoint_companion_descriptor { + + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in + * this context. */ + uint8_t bDescriptorType; + + + /** The maximum number of packets the endpoint can send or + * recieve as part of a burst. */ + uint8_t bMaxBurst; + + /** In bulk EP: bits 4:0 represents the maximum number of + * streams the EP supports. In isochronous EP: bits 1:0 + * represents the Mult - a zero based value that determines + * the maximum number of packets within a service interval */ + uint8_t bmAttributes; + + /** The total number of bytes this EP will transfer every + * service interval. valid only for periodic EPs. */ + uint16_t wBytesPerInterval; +}; + +/** \ingroup desc + * A structure representing the standard USB endpoint descriptor. This + * descriptor is documented in section 9.6.3 of the USB 2.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_endpoint_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_ENDPOINT LIBUSB_DT_ENDPOINT in + * this context. */ + uint8_t bDescriptorType; + + /** The address of the endpoint described by this descriptor. Bits 0:3 are + * the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction, + * see \ref libusb_endpoint_direction. + */ + uint8_t bEndpointAddress; + + /** Attributes which apply to the endpoint when it is configured using + * the bConfigurationValue. Bits 0:1 determine the transfer type and + * correspond to \ref libusb_transfer_type. Bits 2:3 are only used for + * isochronous endpoints and correspond to \ref libusb_iso_sync_type. + * Bits 4:5 are also only used for isochronous endpoints and correspond to + * \ref libusb_iso_usage_type. Bits 6:7 are reserved. + */ + uint8_t bmAttributes; + + /** Maximum packet size this endpoint is capable of sending/receiving. */ + uint16_t wMaxPacketSize; + + /** Interval for polling endpoint for data transfers. */ + uint8_t bInterval; + + /** For audio devices only: the rate at which synchronization feedback + * is provided. */ + uint8_t bRefresh; + + /** For audio devices only: the address if the synch endpoint */ + uint8_t bSynchAddress; + + /** Extra descriptors. If libusb encounters unknown endpoint descriptors, + * it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. */ + int extra_length; +}; + + +/** \ingroup desc + * A structure representing the standard USB interface descriptor. This + * descriptor is documented in section 9.6.5 of the USB 2.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_interface_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_INTERFACE LIBUSB_DT_INTERFACE + * in this context. */ + uint8_t bDescriptorType; + + /** Number of this interface */ + uint8_t bInterfaceNumber; + + /** Value used to select this alternate setting for this interface */ + uint8_t bAlternateSetting; + + /** Number of endpoints used by this interface (excluding the control + * endpoint). */ + uint8_t bNumEndpoints; + + /** USB-IF class code for this interface. See \ref libusb_class_code. */ + uint8_t bInterfaceClass; + + /** USB-IF subclass code for this interface, qualified by the + * bInterfaceClass value */ + uint8_t bInterfaceSubClass; + + /** USB-IF protocol code for this interface, qualified by the + * bInterfaceClass and bInterfaceSubClass values */ + uint8_t bInterfaceProtocol; + + /** Index of string descriptor describing this interface */ + uint8_t iInterface; + + /** Array of endpoint descriptors. This length of this array is determined + * by the bNumEndpoints field. */ + const struct libusb_endpoint_descriptor *endpoint; + + /** Extra descriptors. If libusb encounters unknown interface descriptors, + * it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. */ + int extra_length; +}; + +/** \ingroup desc + * A collection of alternate settings for a particular USB interface. + */ +struct libusb_interface { + /** Array of interface descriptors. The length of this array is determined + * by the num_altsetting field. */ + const struct libusb_interface_descriptor *altsetting; + + /** The number of alternate settings that belong to this interface */ + int num_altsetting; +}; + +/** \ingroup desc + * A structure representing the standard USB configuration descriptor. This + * descriptor is documented in section 9.6.3 of the USB 2.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_config_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_CONFIG LIBUSB_DT_CONFIG + * in this context. */ + uint8_t bDescriptorType; + + /** Total length of data returned for this configuration */ + uint16_t wTotalLength; + + /** Number of interfaces supported by this configuration */ + uint8_t bNumInterfaces; + + /** Identifier value for this configuration */ + uint8_t bConfigurationValue; + + /** Index of string descriptor describing this configuration */ + uint8_t iConfiguration; + + /** Configuration characteristics */ + uint8_t bmAttributes; + + /** Maximum power consumption of the USB device from this bus in this + * configuration when the device is fully opreation. Expressed in units + * of 2 mA. */ + uint8_t MaxPower; + + /** Array of interfaces supported by this configuration. The length of + * this array is determined by the bNumInterfaces field. */ + const struct libusb_interface *interface; + + /** Extra descriptors. If libusb encounters unknown configuration + * descriptors, it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. */ + int extra_length; +}; + +/** \ingroup desc + * A structure representing the BOS descriptor. This + * descriptor is documented in section 9.6.2 of the USB 3.0 + * specification. All multiple-byte fields are represented in + * host-endian format. + */ +struct libusb_bos_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_BOS LIBUSB_DT_BOS + * in this context. */ + uint8_t bDescriptorType; + + /** Length of this descriptor and all of its sub descriptors */ + uint16_t wTotalLength; + + /** The number of separate device capability descriptors in + * the BOS */ + uint8_t bNumDeviceCaps; + + /** USB 2.0 extension capability descriptor */ + struct libusb_usb_2_0_device_capability_descriptor *usb_2_0_ext_cap; + + /** SuperSpeed capabilty descriptor */ + struct libusb_ss_usb_device_capability_descriptor *ss_usb_cap; +}; + +/** \ingroup desc + * A structure representing the device capability descriptor for + * USB 2.0. This descriptor is documented in section 9.6.2.1 of + * the USB 3.0 specification. All mutiple-byte fields are represented + * in host-endian format. + */ +struct libusb_usb_2_0_device_capability_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_USB_CAP_TYPE_EXT + * LIBUSB_USB_CAP_TYPE_EXT in this context. */ + uint8_t bDevCapabilityType; + + /** Bitmap encoding of supported device level features. + * A value of one in a bit location indicates a feature is + * supported; a value of zero indicates it is not supported. + * See \ref libusb_capability_attributes. */ + uint32_t bmAttributes; +}; + +/** \ingroup desc + * A structure representing the device capability descriptor for + * USB 3.0. This descriptor is documented in section 9.6.2.2 of + * the USB 3.0 specification. All mutiple-byte fields are represented + * in host-endian format. + */ +struct libusb_ss_usb_device_capability_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_SS_USB_CAP_TYPE + * LIBUSB_SS_USB_CAP_TYPE in this context. */ + uint8_t bDevCapabilityType; + + /** Bitmap encoding of supported device level features. + * A value of one in a bit location indicates a feature is + * supported; a value of zero indicates it is not supported. + * See \ref libusb_capability_attributes. */ + uint8_t bmAttributes; + + /** Bitmap encoding of the speed supported by this device when + * operating in SuperSpeed mode. See \ref libusb_supported_speed. */ + uint16_t wSpeedSupported; + + /** The lowest speed at which all the functionality supported + * by the device is available to the user. For example if the + * device supports all its functionality when connected at + * full speed and above then it sets this value to 1. */ + uint8_t bFunctionalitySupport; + + /** U1 Device Exit Latency. */ + uint8_t bU1DevExitLat; + + /** U2 Device Exit Latency. */ + uint16_t bU2DevExitLat; +}; + + +/** \ingroup asyncio + * Setup packet for control transfers. */ +struct libusb_control_setup { + /** Request type. Bits 0:4 determine recipient, see + * \ref libusb_request_recipient. Bits 5:6 determine type, see + * \ref libusb_request_type. Bit 7 determines data transfer direction, see + * \ref libusb_endpoint_direction. + */ + uint8_t bmRequestType; + + /** Request. If the type bits of bmRequestType are equal to + * \ref libusb_request_type::LIBUSB_REQUEST_TYPE_STANDARD + * "LIBUSB_REQUEST_TYPE_STANDARD" then this field refers to + * \ref libusb_standard_request. For other cases, use of this field is + * application-specific. */ + uint8_t bRequest; + + /** Value. Varies according to request */ + uint16_t wValue; + + /** Index. Varies according to request, typically used to pass an index + * or offset */ + uint16_t wIndex; + + /** Number of bytes to transfer */ + uint16_t wLength; +}; + +#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup)) + +/* libusb */ + +struct libusb_context; +struct libusb_device; +struct libusb_device_handle; +struct libusb_hotplug_callback; + +/** \ingroup lib + * Structure representing the libusb version. + */ +struct libusb_version { + /** Library major version. */ + const uint16_t major; + + /** Library minor version. */ + const uint16_t minor; + + /** Library micro version. */ + const uint16_t micro; + + /** Library nano version. This field is only nonzero on Windows. */ + const uint16_t nano; + + /** Library release candidate suffix string, e.g. "-rc4". */ + const char *rc; + + /** Output of `git describe --tags` at library build time. */ + const char *describe; +}; + +/** \ingroup lib + * Structure representing a libusb session. The concept of individual libusb + * sessions allows for your program to use two libraries (or dynamically + * load two modules) which both independently use libusb. This will prevent + * interference between the individual libusb users - for example + * libusb_set_debug() will not affect the other user of the library, and + * libusb_exit() will not destroy resources that the other user is still + * using. + * + * Sessions are created by libusb_init() and destroyed through libusb_exit(). + * If your application is guaranteed to only ever include a single libusb + * user (i.e. you), you do not have to worry about contexts: pass NULL in + * every function call where a context is required. The default context + * will be used. + * + * For more information, see \ref contexts. + */ +typedef struct libusb_context libusb_context; + +/** \ingroup dev + * Structure representing a USB device detected on the system. This is an + * opaque type for which you are only ever provided with a pointer, usually + * originating from libusb_get_device_list(). + * + * Certain operations can be performed on a device, but in order to do any + * I/O you will have to first obtain a device handle using libusb_open(). + * + * Devices are reference counted with libusb_ref_device() and + * libusb_unref_device(), and are freed when the reference count reaches 0. + * New devices presented by libusb_get_device_list() have a reference count of + * 1, and libusb_free_device_list() can optionally decrease the reference count + * on all devices in the list. libusb_open() adds another reference which is + * later destroyed by libusb_close(). + */ +typedef struct libusb_device libusb_device; + + +/** \ingroup dev + * Structure representing a handle on a USB device. This is an opaque type for + * which you are only ever provided with a pointer, usually originating from + * libusb_open(). + * + * A device handle is used to perform I/O and other operations. When finished + * with a device handle, you should call libusb_close(). + */ +typedef struct libusb_device_handle libusb_device_handle; + +/** \ingroup dev + * Speed codes. Indicates the speed at which the device is operating. + */ +enum libusb_speed { + /** The OS doesn't report or know the device speed. */ + LIBUSB_SPEED_UNKNOWN = 0, + + /** The device is operating at low speed (1.5MBit/s). */ + LIBUSB_SPEED_LOW = 1, + + /** The device is operating at full speed (12MBit/s). */ + LIBUSB_SPEED_FULL = 2, + + /** The device is operating at high speed (480MBit/s). */ + LIBUSB_SPEED_HIGH = 3, + + /** The device is operating at super speed (5000MBit/s). */ + LIBUSB_SPEED_SUPER = 4, +}; + +/** \ingroup dev + * Supported speeds (wSpeedSupported) bitfield. Indicates what + * speeds the device supports. + */ +enum libusb_supported_speed { + /** Low speed operation supported (1.5MBit/s). */ + LIBUSB_LOW_SPEED_OPERATION = 1, + + /** Full speed operation supported (12MBit/s). */ + LIBUSB_FULL_SPEED_OPERATION = 2, + + /** High speed operation supported (480MBit/s). */ + LIBUSB_HIGH_SPEED_OPERATION = 4, + + /** Superspeed operation supported (5000MBit/s). */ + LIBUSB_5GBPS_OPERATION = 8, +}; + +/** \ingroup dev + * Capability attributes + */ +enum libusb_capability_attributes { + /** Supports Link Power Management (LPM) */ + LIBUSB_LPM_SUPPORT = 2, +}; + +/** \ingroup dev + * USB capability types + */ +enum libusb_capability_type { + /** USB 2.0 extension capability type */ + LIBUSB_USB_CAP_TYPE_EXT = 2, + + /** SuperSpeed capability type */ + LIBUSB_SS_USB_CAP_TYPE = 3, +}; + +/** \ingroup misc + * Error codes. Most libusb functions return 0 on success or one of these + * codes on failure. + * You can call \ref libusb_error_name() to retrieve a string representation + * of an error code or \ret libusb_strerror() to get an english description + * of an error code. + */ +enum libusb_error { + /** Success (no error) */ + LIBUSB_SUCCESS = 0, + + /** Input/output error */ + LIBUSB_ERROR_IO = -1, + + /** Invalid parameter */ + LIBUSB_ERROR_INVALID_PARAM = -2, + + /** Access denied (insufficient permissions) */ + LIBUSB_ERROR_ACCESS = -3, + + /** No such device (it may have been disconnected) */ + LIBUSB_ERROR_NO_DEVICE = -4, + + /** Entity not found */ + LIBUSB_ERROR_NOT_FOUND = -5, + + /** Resource busy */ + LIBUSB_ERROR_BUSY = -6, + + /** Operation timed out */ + LIBUSB_ERROR_TIMEOUT = -7, + + /** Overflow */ + LIBUSB_ERROR_OVERFLOW = -8, + + /** Pipe error */ + LIBUSB_ERROR_PIPE = -9, + + /** System call interrupted (perhaps due to signal) */ + LIBUSB_ERROR_INTERRUPTED = -10, + + /** Insufficient memory */ + LIBUSB_ERROR_NO_MEM = -11, + + /** Operation not supported or unimplemented on this platform */ + LIBUSB_ERROR_NOT_SUPPORTED = -12, + + /* NB! Remember to update libusb_error_name() and + libusb_strerror() when adding new error codes here. */ + + /** Other error */ + LIBUSB_ERROR_OTHER = -99, +}; + +/** \ingroup asyncio + * Transfer status codes */ +enum libusb_transfer_status { + /** Transfer completed without error. Note that this does not indicate + * that the entire amount of requested data was transferred. */ + LIBUSB_TRANSFER_COMPLETED, + + /** Transfer failed */ + LIBUSB_TRANSFER_ERROR, + + /** Transfer timed out */ + LIBUSB_TRANSFER_TIMED_OUT, + + /** Transfer was cancelled */ + LIBUSB_TRANSFER_CANCELLED, + + /** For bulk/interrupt endpoints: halt condition detected (endpoint + * stalled). For control endpoints: control request not supported. */ + LIBUSB_TRANSFER_STALL, + + /** Device was disconnected */ + LIBUSB_TRANSFER_NO_DEVICE, + + /** Device sent more data than requested */ + LIBUSB_TRANSFER_OVERFLOW, +}; + +/** \ingroup asyncio + * libusb_transfer.flags values */ +enum libusb_transfer_flags { + /** Report short frames as errors */ + LIBUSB_TRANSFER_SHORT_NOT_OK = 1<<0, + + /** Automatically free() transfer buffer during libusb_free_transfer() */ + LIBUSB_TRANSFER_FREE_BUFFER = 1<<1, + + /** Automatically call libusb_free_transfer() after callback returns. + * If this flag is set, it is illegal to call libusb_free_transfer() + * from your transfer callback, as this will result in a double-free + * when this flag is acted upon. */ + LIBUSB_TRANSFER_FREE_TRANSFER = 1<<2, + + /** Terminate transfers that are a multiple of the endpoint's + * wMaxPacketSize with an extra zero length packet. This is useful + * when a device protocol mandates that each logical request is + * terminated by an incomplete packet (i.e. the logical requests are + * not separated by other means). + * + * This flag only affects host-to-device transfers to bulk and interrupt + * endpoints. In other situations, it is ignored. + * + * This flag only affects transfers with a length that is a multiple of + * the endpoint's wMaxPacketSize. On transfers of other lengths, this + * flag has no effect. Therefore, if you are working with a device that + * needs a ZLP whenever the end of the logical request falls on a packet + * boundary, then it is sensible to set this flag on every + * transfer (you do not have to worry about only setting it on transfers + * that end on the boundary). + * + * This flag is currently only supported on Linux. + * On other systems, libusb_submit_transfer() will return + * LIBUSB_ERROR_NOT_SUPPORTED for every transfer where this flag is set. + * + * Available since libusb-1.0.9. + */ + LIBUSB_TRANSFER_ADD_ZERO_PACKET = 1 << 3, +}; + +/** \ingroup asyncio + * Isochronous packet descriptor. */ +struct libusb_iso_packet_descriptor { + /** Length of data to request in this packet */ + unsigned int length; + + /** Amount of data that was actually transferred */ + unsigned int actual_length; + + /** Status code for this packet */ + enum libusb_transfer_status status; +}; + +struct libusb_transfer; + +/** \ingroup asyncio + * Asynchronous transfer callback function type. When submitting asynchronous + * transfers, you pass a pointer to a callback function of this type via the + * \ref libusb_transfer::callback "callback" member of the libusb_transfer + * structure. libusb will call this function later, when the transfer has + * completed or failed. See \ref asyncio for more information. + * \param transfer The libusb_transfer struct the callback function is being + * notified about. + */ +typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer); + +/** \ingroup asyncio + * The generic USB transfer structure. The user populates this structure and + * then submits it in order to request a transfer. After the transfer has + * completed, the library populates the transfer with the results and passes + * it back to the user. + */ +struct libusb_transfer { + /** Handle of the device that this transfer will be submitted to */ + libusb_device_handle *dev_handle; + + /** A bitwise OR combination of \ref libusb_transfer_flags. */ + uint8_t flags; + + /** Address of the endpoint where this transfer will be sent. */ + unsigned char endpoint; + + /** Type of the endpoint from \ref libusb_transfer_type */ + unsigned char type; + + /** Timeout for this transfer in millseconds. A value of 0 indicates no + * timeout. */ + unsigned int timeout; + + /** The status of the transfer. Read-only, and only for use within + * transfer callback function. + * + * If this is an isochronous transfer, this field may read COMPLETED even + * if there were errors in the frames. Use the + * \ref libusb_iso_packet_descriptor::status "status" field in each packet + * to determine if errors occurred. */ + enum libusb_transfer_status status; + + /** Length of the data buffer */ + int length; + + /** Actual length of data that was transferred. Read-only, and only for + * use within transfer callback function. Not valid for isochronous + * endpoint transfers. */ + int actual_length; + + /** Callback function. This will be invoked when the transfer completes, + * fails, or is cancelled. */ + libusb_transfer_cb_fn callback; + + /** User context data to pass to the callback function. */ + void *user_data; + + /** Data buffer */ + unsigned char *buffer; + + /** Number of isochronous packets. Only used for I/O with isochronous + * endpoints. */ + int num_iso_packets; + + /** Isochronous packet descriptors, for isochronous transfers only. */ + struct libusb_iso_packet_descriptor iso_packet_desc +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) + [] /* valid C99 code */ +#else + [0] /* non-standard, but usually working code */ +#endif + ; +}; + +/** \ingroup misc + * Capabilities supported by this instance of libusb. Test if the loaded + * library supports a given capability by calling + * \ref libusb_has_capability(). + */ +enum libusb_capability { + /** The libusb_has_capability() API is available. */ + LIBUSB_CAP_HAS_CAPABILITY = 0, + /** The libusb hotplug API is available. */ + LIBUSB_CAP_HAS_HOTPLUG = 1, +}; + +int LIBUSB_CALL libusb_init(libusb_context **ctx); +void LIBUSB_CALL libusb_exit(libusb_context *ctx); +void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level); +const struct libusb_version * LIBUSB_CALL libusb_get_version(void); +int LIBUSB_CALL libusb_has_capability(uint32_t capability); +const char * LIBUSB_CALL libusb_error_name(int errcode); +const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode); + +ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx, + libusb_device ***list); +void LIBUSB_CALL libusb_free_device_list(libusb_device **list, + int unref_devices); +libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev); +void LIBUSB_CALL libusb_unref_device(libusb_device *dev); + +int LIBUSB_CALL libusb_get_configuration(libusb_device_handle *dev, + int *config); +int LIBUSB_CALL libusb_get_device_descriptor(libusb_device *dev, + struct libusb_device_descriptor *desc); +int LIBUSB_CALL libusb_get_active_config_descriptor(libusb_device *dev, + struct libusb_config_descriptor **config); +int LIBUSB_CALL libusb_get_config_descriptor(libusb_device *dev, + uint8_t config_index, struct libusb_config_descriptor **config); +int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev, + uint8_t bConfigurationValue, struct libusb_config_descriptor **config); +void LIBUSB_CALL libusb_free_config_descriptor( + struct libusb_config_descriptor *config); +uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev); +uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev); +int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev); +int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev, + unsigned char endpoint); +int LIBUSB_CALL libusb_get_max_iso_packet_size(libusb_device *dev, + unsigned char endpoint); + +int LIBUSB_CALL libusb_open(libusb_device *dev, libusb_device_handle **handle); +void LIBUSB_CALL libusb_close(libusb_device_handle *dev_handle); +libusb_device * LIBUSB_CALL libusb_get_device(libusb_device_handle *dev_handle); + +int LIBUSB_CALL libusb_set_configuration(libusb_device_handle *dev, + int configuration); +int LIBUSB_CALL libusb_claim_interface(libusb_device_handle *dev, + int interface_number); +int LIBUSB_CALL libusb_release_interface(libusb_device_handle *dev, + int interface_number); + +libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid( + libusb_context *ctx, uint16_t vendor_id, uint16_t product_id); + +int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev, + int interface_number, int alternate_setting); +int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev, + unsigned char endpoint); +int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev); + +int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev, + int interface_number); +int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev, + int interface_number); +int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev, + int interface_number); + +/* async I/O */ + +/** \ingroup asyncio + * Get the data section of a control transfer. This convenience function is here + * to remind you that the data does not start until 8 bytes into the actual + * buffer, as the setup packet comes first. + * + * Calling this function only makes sense from a transfer callback function, + * or situations where you have already allocated a suitably sized buffer at + * transfer->buffer. + * + * \param transfer a transfer + * \returns pointer to the first byte of the data section + */ +static inline unsigned char *libusb_control_transfer_get_data( + struct libusb_transfer *transfer) +{ + return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE; +} + +/** \ingroup asyncio + * Get the control setup packet of a control transfer. This convenience + * function is here to remind you that the control setup occupies the first + * 8 bytes of the transfer data buffer. + * + * Calling this function only makes sense from a transfer callback function, + * or situations where you have already allocated a suitably sized buffer at + * transfer->buffer. + * + * \param transfer a transfer + * \returns a casted pointer to the start of the transfer data buffer + */ +static inline struct libusb_control_setup *libusb_control_transfer_get_setup( + struct libusb_transfer *transfer) +{ + return (struct libusb_control_setup *) transfer->buffer; +} + +/** \ingroup asyncio + * Helper function to populate the setup packet (first 8 bytes of the data + * buffer) for a control transfer. The wIndex, wValue and wLength values should + * be given in host-endian byte order. + * + * \param buffer buffer to output the setup packet into + * \param bmRequestType see the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field of + * \ref libusb_control_setup + * \param bRequest see the + * \ref libusb_control_setup::bRequest "bRequest" field of + * \ref libusb_control_setup + * \param wValue see the + * \ref libusb_control_setup::wValue "wValue" field of + * \ref libusb_control_setup + * \param wIndex see the + * \ref libusb_control_setup::wIndex "wIndex" field of + * \ref libusb_control_setup + * \param wLength see the + * \ref libusb_control_setup::wLength "wLength" field of + * \ref libusb_control_setup + */ +static inline void libusb_fill_control_setup(unsigned char *buffer, + uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, + uint16_t wLength) +{ + struct libusb_control_setup *setup = (struct libusb_control_setup *) buffer; + setup->bmRequestType = bmRequestType; + setup->bRequest = bRequest; + setup->wValue = libusb_cpu_to_le16(wValue); + setup->wIndex = libusb_cpu_to_le16(wIndex); + setup->wLength = libusb_cpu_to_le16(wLength); +} + +struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets); +int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer); +int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer); +void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer); + +/** \ingroup asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a control transfer. + * + * If you pass a transfer buffer to this function, the first 8 bytes will + * be interpreted as a control setup packet, and the wLength field will be + * used to automatically populate the \ref libusb_transfer::length "length" + * field of the transfer. Therefore the recommended approach is: + * -# Allocate a suitably sized data buffer (including space for control setup) + * -# Call libusb_fill_control_setup() + * -# If this is a host-to-device transfer with a data stage, put the data + * in place after the setup packet + * -# Call this function + * -# Call libusb_submit_transfer() + * + * It is also legal to pass a NULL buffer to this function, in which case this + * function will not attempt to populate the length field. Remember that you + * must then populate the buffer and length fields later. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param buffer data buffer. If provided, this function will interpret the + * first 8 bytes as a setup packet and infer the transfer length from that. + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_control_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data, + unsigned int timeout) +{ + struct libusb_control_setup *setup = (struct libusb_control_setup *) buffer; + transfer->dev_handle = dev_handle; + transfer->endpoint = 0; + transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL; + transfer->timeout = timeout; + transfer->buffer = buffer; + if (setup) + transfer->length = LIBUSB_CONTROL_SETUP_SIZE + + libusb_le16_to_cpu(setup->wLength); + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a bulk transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer, + libusb_device_handle *dev_handle, unsigned char endpoint, + unsigned char *buffer, int length, libusb_transfer_cb_fn callback, + void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_BULK; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for an interrupt transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_interrupt_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *buffer, int length, + libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for an isochronous transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param num_iso_packets the number of isochronous packets + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer, + libusb_device_handle *dev_handle, unsigned char endpoint, + unsigned char *buffer, int length, int num_iso_packets, + libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->num_iso_packets = num_iso_packets; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup asyncio + * Convenience function to set the length of all packets in an isochronous + * transfer, based on the num_iso_packets field in the transfer structure. + * + * \param transfer a transfer + * \param length the length to set in each isochronous packet descriptor + * \see libusb_get_max_packet_size() + */ +static inline void libusb_set_iso_packet_lengths( + struct libusb_transfer *transfer, unsigned int length) +{ + int i; + for (i = 0; i < transfer->num_iso_packets; i++) + transfer->iso_packet_desc[i].length = length; +} + +/** \ingroup asyncio + * Convenience function to locate the position of an isochronous packet + * within the buffer of an isochronous transfer. + * + * This is a thorough function which loops through all preceding packets, + * accumulating their lengths to find the position of the specified packet. + * Typically you will assign equal lengths to each packet in the transfer, + * and hence the above method is sub-optimal. You may wish to use + * libusb_get_iso_packet_buffer_simple() instead. + * + * \param transfer a transfer + * \param packet the packet to return the address of + * \returns the base address of the packet buffer inside the transfer buffer, + * or NULL if the packet does not exist. + * \see libusb_get_iso_packet_buffer_simple() + */ +static inline unsigned char *libusb_get_iso_packet_buffer( + struct libusb_transfer *transfer, unsigned int packet) +{ + int i; + size_t offset = 0; + int _packet; + + /* oops..slight bug in the API. packet is an unsigned int, but we use + * signed integers almost everywhere else. range-check and convert to + * signed to avoid compiler warnings. FIXME for libusb-2. */ + if (packet > INT_MAX) + return NULL; + _packet = packet; + + if (_packet >= transfer->num_iso_packets) + return NULL; + + for (i = 0; i < _packet; i++) + offset += transfer->iso_packet_desc[i].length; + + return transfer->buffer + offset; +} + +/** \ingroup asyncio + * Convenience function to locate the position of an isochronous packet + * within the buffer of an isochronous transfer, for transfers where each + * packet is of identical size. + * + * This function relies on the assumption that every packet within the transfer + * is of identical size to the first packet. Calculating the location of + * the packet buffer is then just a simple calculation: + * buffer + (packet_size * packet) + * + * Do not use this function on transfers other than those that have identical + * packet lengths for each packet. + * + * \param transfer a transfer + * \param packet the packet to return the address of + * \returns the base address of the packet buffer inside the transfer buffer, + * or NULL if the packet does not exist. + * \see libusb_get_iso_packet_buffer() + */ +static inline unsigned char *libusb_get_iso_packet_buffer_simple( + struct libusb_transfer *transfer, unsigned int packet) +{ + int _packet; + + /* oops..slight bug in the API. packet is an unsigned int, but we use + * signed integers almost everywhere else. range-check and convert to + * signed to avoid compiler warnings. FIXME for libusb-2. */ + if (packet > INT_MAX) + return NULL; + _packet = packet; + + if (_packet >= transfer->num_iso_packets) + return NULL; + + return transfer->buffer + (transfer->iso_packet_desc[0].length * _packet); +} + +/* sync I/O */ + +int LIBUSB_CALL libusb_control_transfer(libusb_device_handle *dev_handle, + uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, + unsigned char *data, uint16_t wLength, unsigned int timeout); + +int LIBUSB_CALL libusb_bulk_transfer(libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *data, int length, + int *actual_length, unsigned int timeout); + +int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *data, int length, + int *actual_length, unsigned int timeout); + +/** \ingroup desc + * Retrieve a descriptor from the default control pipe. + * This is a convenience function which formulates the appropriate control + * message to retrieve the descriptor. + * + * \param dev a device handle + * \param desc_type the descriptor type, see \ref libusb_descriptor_type + * \param desc_index the index of the descriptor to retrieve + * \param data output buffer for descriptor + * \param length size of data buffer + * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure + */ +static inline int libusb_get_descriptor(libusb_device_handle *dev, + uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length) +{ + return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN, + LIBUSB_REQUEST_GET_DESCRIPTOR, (desc_type << 8) | desc_index, 0, data, + (uint16_t) length, 1000); +} + +/** \ingroup desc + * Retrieve a descriptor from a device. + * This is a convenience function which formulates the appropriate control + * message to retrieve the descriptor. The string returned is Unicode, as + * detailed in the USB specifications. + * + * \param dev a device handle + * \param desc_index the index of the descriptor to retrieve + * \param langid the language ID for the string descriptor + * \param data output buffer for descriptor + * \param length size of data buffer + * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure + * \see libusb_get_string_descriptor_ascii() + */ +static inline int libusb_get_string_descriptor(libusb_device_handle *dev, + uint8_t desc_index, uint16_t langid, unsigned char *data, int length) +{ + return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN, + LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index), + langid, data, (uint16_t) length, 1000); +} + +int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev, + uint8_t desc_index, unsigned char *data, int length); + +/* polling and timeouts */ + +int LIBUSB_CALL libusb_try_lock_events(libusb_context *ctx); +void LIBUSB_CALL libusb_lock_events(libusb_context *ctx); +void LIBUSB_CALL libusb_unlock_events(libusb_context *ctx); +int LIBUSB_CALL libusb_event_handling_ok(libusb_context *ctx); +int LIBUSB_CALL libusb_event_handler_active(libusb_context *ctx); +void LIBUSB_CALL libusb_lock_event_waiters(libusb_context *ctx); +void LIBUSB_CALL libusb_unlock_event_waiters(libusb_context *ctx); +int LIBUSB_CALL libusb_wait_for_event(libusb_context *ctx, struct timeval *tv); + +int LIBUSB_CALL libusb_handle_events_timeout(libusb_context *ctx, + struct timeval *tv); +int LIBUSB_CALL libusb_handle_events_timeout_completed(libusb_context *ctx, + struct timeval *tv, int *completed); +int LIBUSB_CALL libusb_handle_events(libusb_context *ctx); +int LIBUSB_CALL libusb_handle_events_completed(libusb_context *ctx, int *completed); +int LIBUSB_CALL libusb_handle_events_locked(libusb_context *ctx, + struct timeval *tv); +int LIBUSB_CALL libusb_pollfds_handle_timeouts(libusb_context *ctx); +int LIBUSB_CALL libusb_get_next_timeout(libusb_context *ctx, + struct timeval *tv); + +/** \ingroup poll + * File descriptor for polling + */ +struct libusb_pollfd { + /** Numeric file descriptor */ + int fd; + + /** Event flags to poll for from . POLLIN indicates that you + * should monitor this file descriptor for becoming ready to read from, + * and POLLOUT indicates that you should monitor this file descriptor for + * nonblocking write readiness. */ + short events; +}; + +/** \ingroup poll + * Callback function, invoked when a new file descriptor should be added + * to the set of file descriptors monitored for events. + * \param fd the new file descriptor + * \param events events to monitor for, see \ref libusb_pollfd for a + * description + * \param user_data User data pointer specified in + * libusb_set_pollfd_notifiers() call + * \see libusb_set_pollfd_notifiers() + */ +typedef void (LIBUSB_CALL *libusb_pollfd_added_cb)(int fd, short events, + void *user_data); + +/** \ingroup poll + * Callback function, invoked when a file descriptor should be removed from + * the set of file descriptors being monitored for events. After returning + * from this callback, do not use that file descriptor again. + * \param fd the file descriptor to stop monitoring + * \param user_data User data pointer specified in + * libusb_set_pollfd_notifiers() call + * \see libusb_set_pollfd_notifiers() + */ +typedef void (LIBUSB_CALL *libusb_pollfd_removed_cb)(int fd, void *user_data); + +const struct libusb_pollfd ** LIBUSB_CALL libusb_get_pollfds( + libusb_context *ctx); +void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx, + libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, + void *user_data); + +/** \ingroup desc + * Parse a USB 3.0 endpoint companion descriptor. + * + * \param[in] buf the buffer containing the endpoint companion descriptor + * \param[in] len the length of the buffer + * \param[out] ep_comp a parsed endpoint companion descriptor. must be freed by + * libusb_free_ss_endpoint_comp() + * + * \returns LIBUSB_SUCCESS on success + * \returns LIBUSB_ERROR code on error + */ +int LIBUSB_CALL libusb_parse_ss_endpoint_comp(const void *buf, int len, + struct libusb_ss_endpoint_companion_descriptor **ep_comp); + +/** \ingroup desc + * Free a USB 3.0 endpoint companion descriptor. + * + * \param[in] ep_comp the descriptor to free + */ +void LIBUSB_CALL libusb_free_ss_endpoint_comp(struct libusb_ss_endpoint_companion_descriptor *ep_comp); + +/** \ingroup desc + * Parse a Binary Object Store (BOS) descriptor. + * + * \param[in] buf the buffer containing the BOS descriptor + * \param[in] len the length of the buffer + * \param[out] bos a parsed BOS descriptor. must be freed by + * libusb_free_bos_descriptor() + * + * \returns LIBUSB_SUCCESS on success + * \returns LIBUSB_ERROR code on error + */ +int LIBUSB_CALL libusb_parse_bos_descriptor(const void *buf, int len, + struct libusb_bos_descriptor **bos); + +/** \ingroup desc + * Free a Binary Object Store (BOS) descriptor. + * + * \param[in] bos the descriptor to free + */ +void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos); + +/** \ingroup hotplug + * Callback handle. + * + * Callbacks handles are generated by libusb_hotplug_register_callback() + * and can be used to deregister callbacks. Callback handles are unique + * per libusb_context and it is safe to call libusb_hotplug_deregister_callback() + * on an already deregisted callback. + * + * For more information, see \ref hotplug. + */ +typedef int libusb_hotplug_callback_handle; + +/** \ingroup hotplug + * Flags for hotplug events */ +typedef enum { + /** Arm the callback and fire it for all matching currently attached devices. */ + LIBUSB_HOTPLUG_ENUMERATE = 1, +} libusb_hotplug_flag; + +/** \ingroup hotplug + * Hotplug events */ +typedef enum { + /** A device has been plugged in and is ready to use */ + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 0x01, + + /** A device has left and is no longer available. + * It is the user's responsibility to call libusb_close on any handle associated with a disconnected device. + * It is safe to call libusb_get_device_descriptor on a device that has left */ + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 0x02, +} libusb_hotplug_event; + +/** \ingroup hotplug + * Wildcard matching for hotplug events */ +#define LIBUSB_HOTPLUG_MATCH_ANY -1 + +/** \ingroup hotplug + * Hotplug callback function type. When requesting hotplug event notifications, + * you pass a pointer to a callback function of this type. + * + * This callback may be called by an internal event thread and as such it is + * recommended the callback do minimal processing before returning. + * + * libusb will call this function later, when a matching event had happened on + * a matching device. See \ref hotplug for more information. + * + * It is safe to call either libusb_hotplug_register_callback() or + * libusb_hotplug_deregister_callback() from within a callback function. + * + * \param libusb_context context of this notification + * \param device libusb_device this event occurred on + * \param event event that occurred + * \param user_data user data provided when this callback was registered + * \returns bool whether this callback is finished processing events. + * returning 1 will cause this callback to be deregistered + */ +typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx, + libusb_device *device, + libusb_hotplug_event event, + void *user_data); + +/** \ingroup hotplug + * Register a hotplug callback function + * + * Register a callback with the libusb_context. The callback will fire + * when a matching event occurs on a matching device. The callback is + * armed until either it is deregistered with libusb_hotplug_deregister_callback() + * or the supplied callback returns 1 to indicate it is finished processing events. + * + * \param[in] ctx context to register this callback with + * \param[in] events bitwise or of events that will trigger this callback. See \ref + * libusb_hotplug_event + * \param[in] flags hotplug callback flags. See \ref libusb_hotplug_flag + * \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] cb_fn the function to be invoked on a matching event/device + * \param[in] user_data user data to pass to the callback function + * \param[out] handle pointer to store the handle of the allocated callback (can be NULL) + * \returns LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure + */ +int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx, + libusb_hotplug_event events, + libusb_hotplug_flag flags, + int vendor_id, int product_id, + int dev_class, + libusb_hotplug_callback_fn cb_fn, + void *user_data, + libusb_hotplug_callback_handle *handle); + +/** \ingroup hotplug + * Deregisters a hotplug callback. + * + * Deregister a callback from a libusb_context. This function is safe to call from within + * a hotplug callback. + * + * \param[in] ctx context this callback is registered with + * \param[in] handle the handle of the callback to deregister + */ +void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx, + libusb_hotplug_callback_handle handle); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bfgminer3.9/lib/libblkmaker-0.1.0.dylib b/bfgminer3.9/lib/libblkmaker-0.1.0.dylib new file mode 100755 index 0000000..56a5a7a Binary files /dev/null and b/bfgminer3.9/lib/libblkmaker-0.1.0.dylib differ diff --git a/bfgminer3.9/lib/libblkmaker-0.1.dylib b/bfgminer3.9/lib/libblkmaker-0.1.dylib new file mode 120000 index 0000000..d4ce148 --- /dev/null +++ b/bfgminer3.9/lib/libblkmaker-0.1.dylib @@ -0,0 +1 @@ +libblkmaker-0.1.0.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libblkmaker-0.1.la b/bfgminer3.9/lib/libblkmaker-0.1.la new file mode 100755 index 0000000..da32413 --- /dev/null +++ b/bfgminer3.9/lib/libblkmaker-0.1.la @@ -0,0 +1,41 @@ +# libblkmaker-0.1.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libblkmaker-0.1.0.dylib' + +# Names of this library. +library_names='libblkmaker-0.1.0.dylib libblkmaker-0.1.dylib' + +# The name of the static archive. +old_library='' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libblkmaker-0.1. +current=4 +age=4 +revision=1 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Applications/MacMiner.app/Contents/Resources/bfgminer/lib' diff --git a/bfgminer3.9/lib/libblkmaker_jansson-0.1.0.dylib b/bfgminer3.9/lib/libblkmaker_jansson-0.1.0.dylib new file mode 100755 index 0000000..e40e193 Binary files /dev/null and b/bfgminer3.9/lib/libblkmaker_jansson-0.1.0.dylib differ diff --git a/bfgminer3.9/lib/libblkmaker_jansson-0.1.dylib b/bfgminer3.9/lib/libblkmaker_jansson-0.1.dylib new file mode 120000 index 0000000..6560434 --- /dev/null +++ b/bfgminer3.9/lib/libblkmaker_jansson-0.1.dylib @@ -0,0 +1 @@ +libblkmaker_jansson-0.1.0.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libblkmaker_jansson-0.1.la b/bfgminer3.9/lib/libblkmaker_jansson-0.1.la new file mode 100755 index 0000000..da6b944 --- /dev/null +++ b/bfgminer3.9/lib/libblkmaker_jansson-0.1.la @@ -0,0 +1,41 @@ +# libblkmaker_jansson-0.1.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libblkmaker_jansson-0.1.0.dylib' + +# Names of this library. +library_names='libblkmaker_jansson-0.1.0.dylib libblkmaker_jansson-0.1.dylib' + +# The name of the static archive. +old_library='' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs=' -L.libs /Applications/MacMiner.app/Contents/Resources/bfgminer/lib/libblkmaker-0.1.la -L/Applications/MacMiner.app/Contents/Resources/jansson/lib /Applications/MacMiner.app/Contents/Resources/jansson/lib/libjansson.la' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libblkmaker_jansson-0.1. +current=4 +age=4 +revision=1 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Applications/MacMiner.app/Contents/Resources/bfgminer/lib' diff --git a/bfgminer3.9/lib/libevent-2.0.5.dylib b/bfgminer3.9/lib/libevent-2.0.5.dylib new file mode 100755 index 0000000..3747ff2 Binary files /dev/null and b/bfgminer3.9/lib/libevent-2.0.5.dylib differ diff --git a/bfgminer3.9/lib/libevent.a b/bfgminer3.9/lib/libevent.a new file mode 100644 index 0000000..adf549a Binary files /dev/null and b/bfgminer3.9/lib/libevent.a differ diff --git a/bfgminer3.9/lib/libevent.dylib b/bfgminer3.9/lib/libevent.dylib new file mode 120000 index 0000000..4ae2f84 --- /dev/null +++ b/bfgminer3.9/lib/libevent.dylib @@ -0,0 +1 @@ +libevent-2.0.5.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libevent.la b/bfgminer3.9/lib/libevent.la new file mode 100755 index 0000000..72b81d0 --- /dev/null +++ b/bfgminer3.9/lib/libevent.la @@ -0,0 +1,41 @@ +# libevent.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libevent-2.0.5.dylib' + +# Names of this library. +library_names='libevent-2.0.5.dylib libevent.dylib' + +# The name of the static archive. +old_library='libevent.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libevent. +current=6 +age=1 +revision=9 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/admin/xgminer-osx/output/lib' diff --git a/bfgminer3.9/lib/libevent_core-2.0.5.dylib b/bfgminer3.9/lib/libevent_core-2.0.5.dylib new file mode 100755 index 0000000..fdebd7c Binary files /dev/null and b/bfgminer3.9/lib/libevent_core-2.0.5.dylib differ diff --git a/bfgminer3.9/lib/libevent_core.a b/bfgminer3.9/lib/libevent_core.a new file mode 100644 index 0000000..efc7c5e Binary files /dev/null and b/bfgminer3.9/lib/libevent_core.a differ diff --git a/bfgminer3.9/lib/libevent_core.dylib b/bfgminer3.9/lib/libevent_core.dylib new file mode 120000 index 0000000..eb183bb --- /dev/null +++ b/bfgminer3.9/lib/libevent_core.dylib @@ -0,0 +1 @@ +libevent_core-2.0.5.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libevent_core.la b/bfgminer3.9/lib/libevent_core.la new file mode 100755 index 0000000..b7c139b --- /dev/null +++ b/bfgminer3.9/lib/libevent_core.la @@ -0,0 +1,41 @@ +# libevent_core.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libevent_core-2.0.5.dylib' + +# Names of this library. +library_names='libevent_core-2.0.5.dylib libevent_core.dylib' + +# The name of the static archive. +old_library='libevent_core.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libevent_core. +current=6 +age=1 +revision=9 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/admin/xgminer-osx/output/lib' diff --git a/bfgminer3.9/lib/libevent_extra-2.0.5.dylib b/bfgminer3.9/lib/libevent_extra-2.0.5.dylib new file mode 100755 index 0000000..f3247f9 Binary files /dev/null and b/bfgminer3.9/lib/libevent_extra-2.0.5.dylib differ diff --git a/bfgminer3.9/lib/libevent_extra.a b/bfgminer3.9/lib/libevent_extra.a new file mode 100644 index 0000000..ba74cba Binary files /dev/null and b/bfgminer3.9/lib/libevent_extra.a differ diff --git a/bfgminer3.9/lib/libevent_extra.dylib b/bfgminer3.9/lib/libevent_extra.dylib new file mode 120000 index 0000000..c440c1f --- /dev/null +++ b/bfgminer3.9/lib/libevent_extra.dylib @@ -0,0 +1 @@ +libevent_extra-2.0.5.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libevent_extra.la b/bfgminer3.9/lib/libevent_extra.la new file mode 100755 index 0000000..638d642 --- /dev/null +++ b/bfgminer3.9/lib/libevent_extra.la @@ -0,0 +1,41 @@ +# libevent_extra.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libevent_extra-2.0.5.dylib' + +# Names of this library. +library_names='libevent_extra-2.0.5.dylib libevent_extra.dylib' + +# The name of the static archive. +old_library='libevent_extra.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libevent_extra. +current=6 +age=1 +revision=9 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/admin/xgminer-osx/output/lib' diff --git a/bfgminer3.9/lib/libevent_openssl-2.0.5.dylib b/bfgminer3.9/lib/libevent_openssl-2.0.5.dylib new file mode 100755 index 0000000..ba29f50 Binary files /dev/null and b/bfgminer3.9/lib/libevent_openssl-2.0.5.dylib differ diff --git a/bfgminer3.9/lib/libevent_openssl.a b/bfgminer3.9/lib/libevent_openssl.a new file mode 100644 index 0000000..629fdf2 Binary files /dev/null and b/bfgminer3.9/lib/libevent_openssl.a differ diff --git a/bfgminer3.9/lib/libevent_openssl.dylib b/bfgminer3.9/lib/libevent_openssl.dylib new file mode 120000 index 0000000..61af49b --- /dev/null +++ b/bfgminer3.9/lib/libevent_openssl.dylib @@ -0,0 +1 @@ +libevent_openssl-2.0.5.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libevent_openssl.la b/bfgminer3.9/lib/libevent_openssl.la new file mode 100755 index 0000000..9cf55b6 --- /dev/null +++ b/bfgminer3.9/lib/libevent_openssl.la @@ -0,0 +1,41 @@ +# libevent_openssl.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libevent_openssl-2.0.5.dylib' + +# Names of this library. +library_names='libevent_openssl-2.0.5.dylib libevent_openssl.dylib' + +# The name of the static archive. +old_library='libevent_openssl.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs=' -lssl -lcrypto' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libevent_openssl. +current=6 +age=1 +revision=9 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/admin/xgminer-osx/output/lib' diff --git a/bfgminer3.9/lib/libevent_pthreads-2.0.5.dylib b/bfgminer3.9/lib/libevent_pthreads-2.0.5.dylib new file mode 100755 index 0000000..290140d Binary files /dev/null and b/bfgminer3.9/lib/libevent_pthreads-2.0.5.dylib differ diff --git a/bfgminer3.9/lib/libevent_pthreads.a b/bfgminer3.9/lib/libevent_pthreads.a new file mode 100644 index 0000000..c503447 Binary files /dev/null and b/bfgminer3.9/lib/libevent_pthreads.a differ diff --git a/bfgminer3.9/lib/libevent_pthreads.dylib b/bfgminer3.9/lib/libevent_pthreads.dylib new file mode 120000 index 0000000..b3d5df9 --- /dev/null +++ b/bfgminer3.9/lib/libevent_pthreads.dylib @@ -0,0 +1 @@ +libevent_pthreads-2.0.5.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libevent_pthreads.la b/bfgminer3.9/lib/libevent_pthreads.la new file mode 100755 index 0000000..4fbe126 --- /dev/null +++ b/bfgminer3.9/lib/libevent_pthreads.la @@ -0,0 +1,41 @@ +# libevent_pthreads.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libevent_pthreads-2.0.5.dylib' + +# Names of this library. +library_names='libevent_pthreads-2.0.5.dylib libevent_pthreads.dylib' + +# The name of the static archive. +old_library='libevent_pthreads.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libevent_pthreads. +current=6 +age=1 +revision=9 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/admin/xgminer-osx/output/lib' diff --git a/bfgminer3.9/lib/libjansson.4.dylib b/bfgminer3.9/lib/libjansson.4.dylib new file mode 100755 index 0000000..3a0f43e Binary files /dev/null and b/bfgminer3.9/lib/libjansson.4.dylib differ diff --git a/bfgminer3.9/lib/libjansson.a b/bfgminer3.9/lib/libjansson.a new file mode 100644 index 0000000..4cd2a1a Binary files /dev/null and b/bfgminer3.9/lib/libjansson.a differ diff --git a/bfgminer3.9/lib/libjansson.dylib b/bfgminer3.9/lib/libjansson.dylib new file mode 120000 index 0000000..ee977ce --- /dev/null +++ b/bfgminer3.9/lib/libjansson.dylib @@ -0,0 +1 @@ +libjansson.4.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libjansson.la b/bfgminer3.9/lib/libjansson.la new file mode 100755 index 0000000..0901e2d --- /dev/null +++ b/bfgminer3.9/lib/libjansson.la @@ -0,0 +1,41 @@ +# libjansson.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.3ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libjansson.4.dylib' + +# Names of this library. +library_names='libjansson.4.dylib libjansson.dylib' + +# The name of the static archive. +old_library='libjansson.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs=' -L/Users/admin/xgminer-osx/output/lib' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libjansson. +current=9 +age=5 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Applications/MacMiner.app/Contents/Resources/bfgminer/lib' diff --git a/bfgminer3.9/lib/libmicrohttpd.10.dylib b/bfgminer3.9/lib/libmicrohttpd.10.dylib new file mode 100755 index 0000000..41c53a1 Binary files /dev/null and b/bfgminer3.9/lib/libmicrohttpd.10.dylib differ diff --git a/bfgminer3.9/lib/libmicrohttpd.a b/bfgminer3.9/lib/libmicrohttpd.a new file mode 100644 index 0000000..e71181c Binary files /dev/null and b/bfgminer3.9/lib/libmicrohttpd.a differ diff --git a/bfgminer3.9/lib/libmicrohttpd.dylib b/bfgminer3.9/lib/libmicrohttpd.dylib new file mode 120000 index 0000000..4dc00b1 --- /dev/null +++ b/bfgminer3.9/lib/libmicrohttpd.dylib @@ -0,0 +1 @@ +libmicrohttpd.10.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libmicrohttpd.la b/bfgminer3.9/lib/libmicrohttpd.la new file mode 100755 index 0000000..84c6a16 --- /dev/null +++ b/bfgminer3.9/lib/libmicrohttpd.la @@ -0,0 +1,41 @@ +# libmicrohttpd.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.3 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libmicrohttpd.10.dylib' + +# Names of this library. +library_names='libmicrohttpd.10.dylib libmicrohttpd.dylib' + +# The name of the static archive. +old_library='libmicrohttpd.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libmicrohttpd. +current=30 +age=20 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/admin/xgminer-osx/output/lib' diff --git a/bfgminer3.9/lib/libusb-1.0.2.dylib b/bfgminer3.9/lib/libusb-1.0.2.dylib new file mode 100755 index 0000000..66c02e1 Binary files /dev/null and b/bfgminer3.9/lib/libusb-1.0.2.dylib differ diff --git a/bfgminer3.9/lib/libusb-1.0.a b/bfgminer3.9/lib/libusb-1.0.a new file mode 100644 index 0000000..7c4526e Binary files /dev/null and b/bfgminer3.9/lib/libusb-1.0.a differ diff --git a/bfgminer3.9/lib/libusb-1.0.dylib b/bfgminer3.9/lib/libusb-1.0.dylib new file mode 120000 index 0000000..d6874bc --- /dev/null +++ b/bfgminer3.9/lib/libusb-1.0.dylib @@ -0,0 +1 @@ +libusb-1.0.2.dylib \ No newline at end of file diff --git a/bfgminer3.9/lib/libusb-1.0.la b/bfgminer3.9/lib/libusb-1.0.la new file mode 100755 index 0000000..4153cd8 --- /dev/null +++ b/bfgminer3.9/lib/libusb-1.0.la @@ -0,0 +1,41 @@ +# libusb-1.0.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.3ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libusb-1.0.2.dylib' + +# Names of this library. +library_names='libusb-1.0.2.dylib libusb-1.0.dylib' + +# The name of the static archive. +old_library='libusb-1.0.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' ' + +# Libraries that this one depends upon. +dependency_libs=' -L/Users/admin/xgminer-osx/output/lib -lobjc' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libusb-1.0. +current=2 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Applications/MacMiner.app/Contents/Resources/bfgminer/lib' diff --git a/bfgminer3.9/lib/pkgconfig/jansson.pc b/bfgminer3.9/lib/pkgconfig/jansson.pc new file mode 100644 index 0000000..5044f0c --- /dev/null +++ b/bfgminer3.9/lib/pkgconfig/jansson.pc @@ -0,0 +1,10 @@ +prefix=/Applications/MacMiner.app/Contents/Resources/bfgminer +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: Jansson +Description: Library for encoding, decoding and manipulating JSON data +Version: 2.5 +Libs: -L${libdir} -ljansson +Cflags: -I${includedir} diff --git a/bfgminer3.9/lib/pkgconfig/libblkmaker_jansson-0.1.pc b/bfgminer3.9/lib/pkgconfig/libblkmaker_jansson-0.1.pc new file mode 100644 index 0000000..abb5ef7 --- /dev/null +++ b/bfgminer3.9/lib/pkgconfig/libblkmaker_jansson-0.1.pc @@ -0,0 +1,11 @@ +prefix=/Applications/MacMiner.app/Contents/Resources/bfgminer +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libblkmaker_jansson +Description: Bitcoin block maker library. +Version: 0.1 +URL: http://gitorious.org/bitcoin/libblkmaker +Libs: -L${libdir} -lblkmaker-0.1 -lblkmaker_jansson-0.1 +Cflags: -I${includedir}/libblkmaker-0.1 diff --git a/bfgminer3.9/lib/pkgconfig/libevent.pc b/bfgminer3.9/lib/pkgconfig/libevent.pc new file mode 100644 index 0000000..3822b08 --- /dev/null +++ b/bfgminer3.9/lib/pkgconfig/libevent.pc @@ -0,0 +1,16 @@ +#libevent pkg-config source file + +prefix=/Applications/MacMiner.app/Contents/Resources/bfgminer +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libevent +Description: libevent is an asynchronous notification event loop library +Version: 2.0.21-stable +Requires: +Conflicts: +Libs: -L${libdir} -levent +Libs.private: +Cflags: -I${includedir} + diff --git a/bfgminer3.9/lib/pkgconfig/libevent_openssl.pc b/bfgminer3.9/lib/pkgconfig/libevent_openssl.pc new file mode 100644 index 0000000..b7c1436 --- /dev/null +++ b/bfgminer3.9/lib/pkgconfig/libevent_openssl.pc @@ -0,0 +1,16 @@ +#libevent pkg-config source file + +prefix=/Applications/MacMiner.app/Contents/Resources/bfgminer +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libevent_openssl +Description: libevent_openssl adds openssl-based TLS support to libevent +Version: 2.0.21-stable +Requires: libevent +Conflicts: +Libs: -L${libdir} -levent_openssl +Libs.private: -lssl -lcrypto +Cflags: -I${includedir} + diff --git a/bfgminer3.9/lib/pkgconfig/libevent_pthreads.pc b/bfgminer3.9/lib/pkgconfig/libevent_pthreads.pc new file mode 100644 index 0000000..d0a22b3 --- /dev/null +++ b/bfgminer3.9/lib/pkgconfig/libevent_pthreads.pc @@ -0,0 +1,16 @@ +#libevent pkg-config source file + +prefix=/Applications/MacMiner.app/Contents/Resources/bfgminer +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libevent_pthreads +Description: libevent_pthreads adds pthreads-based threading support to libevent +Version: 2.0.21-stable +Requires: libevent +Conflicts: +Libs: -L${libdir} -levent_pthreads +Libs.private: +Cflags: -I${includedir} -D_THREAD_SAFE + diff --git a/bfgminer3.9/lib/pkgconfig/libmicrohttpd.pc b/bfgminer3.9/lib/pkgconfig/libmicrohttpd.pc new file mode 100644 index 0000000..b3ef0e9 --- /dev/null +++ b/bfgminer3.9/lib/pkgconfig/libmicrohttpd.pc @@ -0,0 +1,13 @@ +prefix=/Applications/MacMiner.app/Contents/Resources/bfgminer +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libmicrohttpd +Description: A library for creating an embedded HTTP server +Version: 0.9.31 +Requires: +Conflicts: +Libs: -L${libdir} -lmicrohttpd +Libs.private: +Cflags: -I${includedir} diff --git a/bfgminer3.9/lib/pkgconfig/libusb-1.0.pc b/bfgminer3.9/lib/pkgconfig/libusb-1.0.pc new file mode 100644 index 0000000..60ca956 --- /dev/null +++ b/bfgminer3.9/lib/pkgconfig/libusb-1.0.pc @@ -0,0 +1,12 @@ +prefix=/Applications/MacMiner.app/Contents/Resources/bfgminer +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libusb-1.0 +Description: C API for USB device access from Linux, Mac OS X, OpenBSD, NetBSD and Windows userspace +Version: 1.0.16-rc10 +Libs: -L${libdir} -lusb-1.0 +Libs.private: -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation +Cflags: -I${includedir}/libusb-1.0 + diff --git a/bfgminer3.9/share/bfgminer/bitstreams/fpgaminer_x6500-overclocker-0402.bit b/bfgminer3.9/share/bfgminer/bitstreams/fpgaminer_x6500-overclocker-0402.bit new file mode 100644 index 0000000..de00ad5 Binary files /dev/null and b/bfgminer3.9/share/bfgminer/bitstreams/fpgaminer_x6500-overclocker-0402.bit differ diff --git a/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15b1.bit b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15b1.bit new file mode 100644 index 0000000..4ed6f4c Binary files /dev/null and b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15b1.bit differ diff --git a/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d1.bit b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d1.bit new file mode 100644 index 0000000..b87eaf4 Binary files /dev/null and b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d1.bit differ diff --git a/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d3.bit b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d3.bit new file mode 100644 index 0000000..78157a5 Binary files /dev/null and b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d3.bit differ diff --git a/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d4.bin b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d4.bin new file mode 100644 index 0000000..411c172 Binary files /dev/null and b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d4.bin differ diff --git a/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d4.bit b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d4.bit new file mode 100644 index 0000000..0951976 Binary files /dev/null and b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15d4.bit differ diff --git a/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15y1.bin b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15y1.bin new file mode 100644 index 0000000..f1532f0 Binary files /dev/null and b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15y1.bin differ diff --git a/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15y1.bit b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15y1.bit new file mode 100644 index 0000000..c9b38ae Binary files /dev/null and b/bfgminer3.9/share/bfgminer/bitstreams/ztex_ufm1_15y1.bit differ diff --git a/bfgminer3.9/share/bfgminer/opencl/diablo130302.cl b/bfgminer3.9/share/bfgminer/opencl/diablo130302.cl new file mode 100644 index 0000000..a721803 --- /dev/null +++ b/bfgminer3.9/share/bfgminer/opencl/diablo130302.cl @@ -0,0 +1,1361 @@ +/* + * DiabloMiner - OpenCL miner for BitCoin + * Copyright (C) 2012, 2013 Con Kolivas + * Copyright (C) 2010, 2011, 2012 Patrick McFarland + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more detail). + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifdef VECTORS4 + typedef uint4 z; +#elif defined(VECTORS2) + typedef uint2 z; +#else + typedef uint z; +#endif + +#ifdef BITALIGN +#pragma OPENCL EXTENSION cl_amd_media_ops : enable +#define Zrotr(a, b) amd_bitalign((z)a, (z)a, (z)(32 - b)) +#else +#define Zrotr(a, b) rotate((z)a, (z)b) +#endif + +#ifdef BFI_INT +#define ZCh(a, b, c) amd_bytealign(a, b, c) +#define ZMa(a, b, c) amd_bytealign((c ^ a), (b), (a)) +#else +#define ZCh(a, b, c) bitselect((z)c, (z)b, (z)a) +#define ZMa(a, b, c) bitselect((z)a, (z)b, (z)c ^ (z)a) +#endif + +/* These constants are not the classic SHA256 constants but the order that + * constants are used in this kernel. + */ +__constant uint K[] = { + 0xd807aa98U, + 0x12835b01U, + 0x243185beU, + 0x550c7dc3U, + 0x72be5d74U, + 0x80deb1feU, + 0x9bdc06a7U, + 0xc19bf3f4U, + 0x0fc19dc6U, + 0x240ca1ccU, + 0x80000000U, // 10 + 0x2de92c6fU, + 0x4a7484aaU, + 0x00000280U, + 0x5cb0a9dcU, + 0x76f988daU, + 0x983e5152U, + 0xa831c66dU, + 0xb00327c8U, + 0xbf597fc7U, + 0xc6e00bf3U, // 20 + 0x00A00055U, + 0xd5a79147U, + 0x06ca6351U, + 0x14292967U, + 0x27b70a85U, + 0x2e1b2138U, + 0x4d2c6dfcU, + 0x53380d13U, + 0x650a7354U, + 0x766a0abbU, // 30 + 0x81c2c92eU, + 0x92722c85U, + 0xa2bfe8a1U, + 0xa81a664bU, + 0xc24b8b70U, + 0xc76c51a3U, + 0xd192e819U, + 0xd6990624U, + 0xf40e3585U, + 0x106aa070U, // 40 + 0x19a4c116U, + 0x1e376c08U, + 0x2748774cU, + 0x34b0bcb5U, + 0x391c0cb3U, + 0x4ed8aa4aU, + 0x5b9cca4fU, + 0x682e6ff3U, + 0x748f82eeU, + 0x78a5636fU, // 50 + 0x84c87814U, + 0x8cc70208U, + 0x90befffaU, + 0xa4506cebU, + 0xbef9a3f7U, + 0xc67178f2U, + 0x98c7e2a2U, + 0x90bb1e3cU, + 0x510e527fU, + 0x9b05688cU, // 60 + 0xfc08884dU, + 0x3c6ef372U, + 0x50c6645bU, + 0x6a09e667U, + 0xbb67ae85U, + 0x3ac42e24U, + 0xd21ea4fdU, + 0x59f111f1U, + 0x923f82a4U, + 0xab1c5ed5U, // 70 + 0x5807aa98U, + 0xc19bf274U, + 0xe49b69c1U, + 0x00a00000U, + 0xefbe4786U, + 0x00000100U, + 0x11002000U, + 0x00400022U, + 0x136032EDU +}; + +#define ZR25(n) ((Zrotr((n), 25) ^ Zrotr((n), 14) ^ ((n) >> 3U))) +#define ZR15(n) ((Zrotr((n), 15) ^ Zrotr((n), 13) ^ ((n) >> 10U))) +#define ZR26(n) ((Zrotr((n), 26) ^ Zrotr((n), 21) ^ Zrotr((n), 7))) +#define ZR30(n) ((Zrotr((n), 30) ^ Zrotr((n), 19) ^ Zrotr((n), 10))) + +__kernel +__attribute__((vec_type_hint(z))) +__attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) +void search( +#ifndef GOFFSET + const z base, +#endif + const uint PreVal4_state0, const uint PreVal4_state0_k7, + const uint PreVal4_T1, + const uint W18, const uint W19, + const uint W16, const uint W17, + const uint W16_plus_K16, const uint W17_plus_K17, + const uint W31, const uint W32, + const uint d1, const uint b1, const uint c1, + const uint h1, const uint f1, const uint g1, + const uint c1_plus_k5, const uint b1_plus_k6, + const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + volatile __global uint * output) +{ + + z ZA[930]; + +#ifdef GOFFSET + const z Znonce = (uint)(get_global_id(0)); +#else + const z Znonce = base + (uint)(get_global_id(0)); +#endif + + ZA[15] = Znonce + PreVal4_state0; + + ZA[16] = (ZCh(ZA[15], b1, c1) + d1) + ZR26(ZA[15]); + ZA[26] = Znonce + PreVal4_T1; + + ZA[27] = ZMa(f1, g1, ZA[26]) + ZR30(ZA[26]); + ZA[17] = ZA[16] + h1; + + ZA[19] = (ZCh(ZA[17], ZA[15], b1) + c1_plus_k5) + ZR26(ZA[17]); + ZA[28] = ZA[27] + ZA[16]; + + ZA[548] = ZMa(ZA[26], f1, ZA[28]) + ZR30(ZA[28]); + ZA[20] = ZA[19] + g1; + + ZA[22] = (ZCh(ZA[20], ZA[17], ZA[15]) + b1_plus_k6) + ZR26(ZA[20]); + ZA[29] = ZA[548] + ZA[19]; + + ZA[549] = ZMa(ZA[28], ZA[26], ZA[29]) + ZR30(ZA[29]); + ZA[23] = ZA[22] + f1; + + ZA[24] = ZCh(ZA[23], ZA[20], ZA[17]) + ZR26(ZA[23]); + ZA[180] = Znonce + PreVal4_state0_k7; + ZA[30] = ZA[549] + ZA[22]; + + ZA[31] = ZMa(ZA[29], ZA[28], ZA[30]) + ZR30(ZA[30]); + ZA[181] = ZA[180] + ZA[24]; + + ZA[182] = ZA[181] + ZA[26]; + ZA[183] = ZA[181] + ZA[31]; + ZA[18] = ZA[17] + K[0]; + + ZA[186] = (ZCh(ZA[182], ZA[23], ZA[20]) + ZA[18]) + ZR26(ZA[182]); + ZA[184] = ZMa(ZA[30], ZA[29], ZA[183]) + ZR30(ZA[183]); + + ZA[187] = ZA[186] + ZA[28]; + ZA[188] = ZA[186] + ZA[184]; + ZA[21] = ZA[20] + K[1]; + + ZA[191] = (ZCh(ZA[187], ZA[182], ZA[23]) + ZA[21]) + ZR26(ZA[187]); + ZA[189] = ZMa(ZA[183], ZA[30], ZA[188]) + ZR30(ZA[188]); + + ZA[192] = ZA[191] + ZA[29]; + ZA[193] = ZA[191] + ZA[189]; + ZA[25] = ZA[23] + K[2]; + + ZA[196] = (ZCh(ZA[192], ZA[187], ZA[182]) + ZA[25]) + ZR26(ZA[192]); + ZA[194] = ZMa(ZA[188], ZA[183], ZA[193]) + ZR30(ZA[193]); + + ZA[197] = ZA[196] + ZA[30]; + ZA[198] = ZA[196] + ZA[194]; + ZA[185] = ZA[182] + K[3]; + + ZA[201] = (ZCh(ZA[197], ZA[192], ZA[187]) + ZA[185]) + ZR26(ZA[197]); + ZA[199] = ZMa(ZA[193], ZA[188], ZA[198]) + ZR30(ZA[198]); + + ZA[202] = ZA[201] + ZA[183]; + ZA[203] = ZA[201] + ZA[199]; + ZA[190] = ZA[187] + K[4]; + + ZA[206] = (ZCh(ZA[202], ZA[197], ZA[192]) + ZA[190]) + ZR26(ZA[202]); + ZA[204] = ZMa(ZA[198], ZA[193], ZA[203]) + ZR30(ZA[203]); + + ZA[207] = ZA[206] + ZA[188]; + ZA[208] = ZA[206] + ZA[204]; + ZA[195] = ZA[192] + K[5]; + + ZA[211] = (ZCh(ZA[207], ZA[202], ZA[197]) + ZA[195]) + ZR26(ZA[207]); + ZA[209] = ZMa(ZA[203], ZA[198], ZA[208]) + ZR30(ZA[208]); + + ZA[212] = ZA[193] + ZA[211]; + ZA[213] = ZA[211] + ZA[209]; + ZA[200] = ZA[197] + K[6]; + + ZA[216] = (ZCh(ZA[212], ZA[207], ZA[202]) + ZA[200]) + ZR26(ZA[212]); + ZA[214] = ZMa(ZA[208], ZA[203], ZA[213]) + ZR30(ZA[213]); + + ZA[217] = ZA[198] + ZA[216]; + ZA[218] = ZA[216] + ZA[214]; + ZA[205] = ZA[202] + K[7]; + + ZA[220] = (ZCh(ZA[217], ZA[212], ZA[207]) + ZA[205]) + ZR26(ZA[217]); + ZA[219] = ZMa(ZA[213], ZA[208], ZA[218]) + ZR30(ZA[218]); + + ZA[222] = ZA[203] + ZA[220]; + ZA[223] = ZA[220] + ZA[219]; + ZA[210] = ZA[207] + W16_plus_K16; + + ZA[226] = (ZCh(ZA[222], ZA[217], ZA[212]) + ZA[210]) + ZR26(ZA[222]); + ZA[225] = ZMa(ZA[218], ZA[213], ZA[223]) + ZR30(ZA[223]); + + ZA[0] = ZR25(Znonce) + W18; + ZA[228] = ZA[226] + ZA[225]; + ZA[227] = ZA[208] + ZA[226]; + ZA[215] = ZA[212] + W17_plus_K17; + + ZA[231] = (ZCh(ZA[227], ZA[222], ZA[217]) + ZA[215]) + ZR26(ZA[227]); + ZA[229] = ZMa(ZA[223], ZA[218], ZA[228]) + ZR30(ZA[228]); + ZA[1] = ZA[0] + K[8]; + + ZA[232] = ZA[213] + ZA[231]; + ZA[233] = ZA[231] + ZA[229]; + ZA[221] = ZA[217] + ZA[1]; + ZA[32] = Znonce + W19; + + ZA[236] = (ZCh(ZA[232], ZA[227], ZA[222]) + ZA[221]) + ZR26(ZA[232]); + ZA[234] = ZMa(ZA[228], ZA[223], ZA[233]) + ZR30(ZA[233]); + ZA[33] = ZA[32] + K[9]; + + ZA[3] = ZR15(ZA[0]) + K[10]; + ZA[238] = ZA[236] + ZA[234]; + ZA[237] = ZA[218] + ZA[236]; + ZA[224] = ZA[222] + ZA[33]; + + ZA[241] = (ZCh(ZA[237], ZA[232], ZA[227]) + ZA[224]) + ZR26(ZA[237]); + ZA[239] = ZMa(ZA[233], ZA[228], ZA[238]) + ZR30(ZA[238]); + ZA[4] = ZA[3] + K[11]; + + ZA[35] = ZR15(ZA[32]); + ZA[243] = ZA[241] + ZA[239]; + ZA[242] = ZA[223] + ZA[241]; + ZA[230] = ZA[227] + ZA[4]; + + ZA[246] = (ZCh(ZA[242], ZA[237], ZA[232]) + ZA[230]) + ZR26(ZA[242]); + ZA[244] = ZMa(ZA[238], ZA[233], ZA[243]) + ZR30(ZA[243]); + ZA[36] = ZA[35] + K[12]; + + ZA[7] = ZR15(ZA[3]) + K[13]; + ZA[248] = ZA[246] + ZA[244]; + ZA[247] = ZA[228] + ZA[246]; + ZA[235] = ZA[232] + ZA[36]; + + ZA[251] = (ZCh(ZA[247], ZA[242], ZA[237]) + ZA[235]) + ZR26(ZA[247]); + ZA[249] = ZMa(ZA[243], ZA[238], ZA[248]) + ZR30(ZA[248]); + ZA[8] = ZA[7] + K[14]; + + ZA[38] = ZR15(ZA[35]) + W16; + ZA[253] = ZA[251] + ZA[249]; + ZA[252] = ZA[233] + ZA[251]; + ZA[240] = ZA[237] + ZA[8]; + + ZA[256] = (ZCh(ZA[252], ZA[247], ZA[242]) + ZA[240]) + ZR26(ZA[252]); + ZA[254] = ZMa(ZA[248], ZA[243], ZA[253]) + ZR30(ZA[253]); + ZA[40] = ZA[38] + K[15]; + + ZA[10] = ZR15(ZA[7]) + W17; + ZA[258] = ZA[256] + ZA[254]; + ZA[257] = ZA[238] + ZA[256]; + ZA[245] = ZA[242] + ZA[40]; + + ZA[261] = (ZCh(ZA[257], ZA[252], ZA[247]) + ZA[245]) + ZR26(ZA[257]); + ZA[259] = ZMa(ZA[253], ZA[248], ZA[258]) + ZR30(ZA[258]); + ZA[13] = ZA[10] + K[16]; + + ZA[43] = ZR15(ZA[38]) + ZA[0]; + ZA[263] = ZA[261] + ZA[259]; + ZA[262] = ZA[243] + ZA[261]; + ZA[250] = ZA[247] + ZA[13]; + + ZA[266] = (ZCh(ZA[262], ZA[257], ZA[252]) + ZA[250]) + ZR26(ZA[262]); + ZA[264] = ZMa(ZA[258], ZA[253], ZA[263]) + ZR30(ZA[263]); + ZA[11] = ZR15(ZA[10]); + ZA[45] = ZA[43] + K[17]; + + ZA[52] = ZA[11] + ZA[32]; + ZA[267] = ZA[248] + ZA[266]; + ZA[255] = ZA[252] + ZA[45]; + ZA[268] = ZA[266] + ZA[264]; + + ZA[271] = (ZCh(ZA[267], ZA[262], ZA[257]) + ZA[255]) + ZR26(ZA[267]); + ZA[269] = ZMa(ZA[263], ZA[258], ZA[268]) + ZR30(ZA[268]); + ZA[54] = ZA[52] + K[18]; + + ZA[48] = ZR15(ZA[43]) + ZA[3]; + ZA[273] = ZA[271] + ZA[269]; + ZA[272] = ZA[253] + ZA[271]; + ZA[260] = ZA[257] + ZA[54]; + + ZA[276] = (ZCh(ZA[272], ZA[267], ZA[262]) + ZA[260]) + ZR26(ZA[272]); + ZA[274] = ZMa(ZA[268], ZA[263], ZA[273]) + ZR30(ZA[273]); + ZA[49] = ZA[48] + K[19]; + + ZA[61] = ZR15(ZA[52]) + ZA[35]; + ZA[278] = ZA[276] + ZA[274]; + ZA[277] = ZA[258] + ZA[276]; + ZA[265] = ZA[262] + ZA[49]; + + ZA[281] = (ZCh(ZA[277], ZA[272], ZA[267]) + ZA[265]) + ZR26(ZA[277]); + ZA[279] = ZMa(ZA[273], ZA[268], ZA[278]) + ZR30(ZA[278]); + ZA[62] = ZA[61] + K[20]; + + ZA[53] = ZR15(ZA[48]) + ZA[7]; + ZA[283] = ZA[281] + ZA[279]; + ZA[282] = ZA[263] + ZA[281]; + ZA[270] = ZA[267] + ZA[62]; + + ZA[286] = (ZCh(ZA[282], ZA[277], ZA[272]) + ZA[270]) + ZR26(ZA[282]); + ZA[284] = ZMa(ZA[278], ZA[273], ZA[283]) + ZR30(ZA[283]); + ZA[39] = ZA[38] + K[21]; + ZA[55] = ZA[53] + K[22]; + + ZA[66] = ZR15(ZA[61]) + ZA[39]; + ZA[288] = ZA[286] + ZA[284]; + ZA[287] = ZA[268] + ZA[286]; + ZA[275] = ZA[272] + ZA[55]; + + ZA[291] = (ZCh(ZA[287], ZA[282], ZA[277]) + ZA[275]) + ZR26(ZA[287]); + ZA[289] = ZMa(ZA[283], ZA[278], ZA[288]) + ZR30(ZA[288]); + ZA[12] = ZA[10] + W31; + ZA[68] = ZA[66] + K[23]; + + ZA[67] = ZR15(ZA[53]) + ZA[12]; + ZA[293] = ZA[291] + ZA[289]; + ZA[292] = ZA[273] + ZA[291]; + ZA[280] = ZA[277] + ZA[68]; + + ZA[296] = (ZCh(ZA[292], ZA[287], ZA[282]) + ZA[280]) + ZR26(ZA[292]); + ZA[294] = ZMa(ZA[288], ZA[283], ZA[293]) + ZR30(ZA[293]); + ZA[2] = ZR25(ZA[0]); + ZA[69] = ZA[67] + K[24]; + ZA[44] = ZA[43] + W32; + + ZA[75] = ZR15(ZA[66]) + ZA[44]; + ZA[298] = ZA[296] + ZA[294]; + ZA[297] = ZA[278] + ZA[296]; + ZA[285] = ZA[282] + ZA[69]; + ZA[5] = ZA[2] + W17; + + ZA[301] = (ZCh(ZA[297], ZA[292], ZA[287]) + ZA[285]) + ZR26(ZA[297]); + ZA[299] = ZMa(ZA[293], ZA[288], ZA[298]) + ZR30(ZA[298]); + ZA[56] = ZA[52] + ZA[5]; + ZA[76] = ZA[75] + K[25]; + + ZA[34] = ZR25(ZA[32]) + ZA[0]; + ZA[70] = ZR15(ZA[67]) + ZA[56]; + ZA[302] = ZA[283] + ZA[301]; + ZA[303] = ZA[301] + ZA[299]; + ZA[290] = ZA[287] + ZA[76]; + + ZA[306] = (ZCh(ZA[302], ZA[297], ZA[292]) + ZA[290]) + ZR26(ZA[302]); + ZA[304] = ZMa(ZA[298], ZA[293], ZA[303]) + ZR30(ZA[303]); + ZA[6] = ZR25(ZA[3]); + ZA[77] = ZA[70] + K[26]; + ZA[50] = ZA[34] + ZA[48]; + + ZA[78] = ZR15(ZA[75]) + ZA[50]; + ZA[308] = ZA[306] + ZA[304]; + ZA[307] = ZA[288] + ZA[306]; + ZA[295] = ZA[292] + ZA[77]; + ZA[41] = ZA[32] + ZA[6]; + + ZA[311] = (ZCh(ZA[307], ZA[302], ZA[297]) + ZA[295]) + ZR26(ZA[307]); + ZA[309] = ZMa(ZA[303], ZA[298], ZA[308]) + ZR30(ZA[308]); + ZA[63] = ZA[41] + ZA[61]; + ZA[85] = ZA[78] + K[27]; + + ZA[37] = ZR25(ZA[35]) + ZA[3]; + ZA[79] = ZR15(ZA[70]) + ZA[63]; + ZA[312] = ZA[293] + ZA[311]; + ZA[313] = ZA[311] + ZA[309]; + ZA[300] = ZA[297] + ZA[85]; + + ZA[316] = (ZCh(ZA[312], ZA[307], ZA[302]) + ZA[300]) + ZR26(ZA[312]); + ZA[314] = ZMa(ZA[308], ZA[303], ZA[313]) + ZR30(ZA[313]); + ZA[9] = ZR25(ZA[7]); + ZA[86] = ZA[79] + K[28]; + ZA[57] = ZA[37] + ZA[53]; + + ZA[87] = ZR15(ZA[78]) + ZA[57]; + ZA[318] = ZA[316] + ZA[314]; + ZA[317] = ZA[298] + ZA[316]; + ZA[305] = ZA[302] + ZA[86]; + ZA[46] = ZA[35] + ZA[9]; + + ZA[321] = (ZCh(ZA[317], ZA[312], ZA[307]) + ZA[305]) + ZR26(ZA[317]); + ZA[319] = ZMa(ZA[313], ZA[308], ZA[318]) + ZR30(ZA[318]); + ZA[71] = ZA[46] + ZA[66]; + ZA[92] = ZA[87] + K[29]; + + ZA[42] = ZR25(ZA[38]) + ZA[7]; + ZA[88] = ZR15(ZA[79]) + ZA[71]; + ZA[322] = ZA[303] + ZA[321]; + ZA[323] = ZA[321] + ZA[319]; + ZA[310] = ZA[307] + ZA[92]; + + ZA[326] = (ZCh(ZA[322], ZA[317], ZA[312]) + ZA[310]) + ZR26(ZA[322]); + ZA[324] = ZMa(ZA[318], ZA[313], ZA[323]) + ZR30(ZA[323]); + ZA[14] = ZR25(ZA[10]); + ZA[93] = ZA[88] + K[30]; + ZA[72] = ZA[42] + ZA[67]; + + ZA[94] = ZR15(ZA[87]) + ZA[72]; + ZA[328] = ZA[326] + ZA[324]; + ZA[327] = ZA[308] + ZA[326]; + ZA[315] = ZA[312] + ZA[93]; + ZA[51] = ZA[38] + ZA[14]; + + ZA[331] = (ZCh(ZA[327], ZA[322], ZA[317]) + ZA[315]) + ZR26(ZA[327]); + ZA[329] = ZMa(ZA[323], ZA[318], ZA[328]) + ZR30(ZA[328]); + ZA[80] = ZA[51] + ZA[75]; + ZA[100] = ZA[94] + K[31]; + + ZA[47] = ZR25(ZA[43]) + ZA[10]; + ZA[95] = ZR15(ZA[88]) + ZA[80]; + ZA[332] = ZA[313] + ZA[331]; + ZA[333] = ZA[331] + ZA[329]; + ZA[320] = ZA[317] + ZA[100]; + + ZA[336] = (ZCh(ZA[332], ZA[327], ZA[322]) + ZA[320]) + ZR26(ZA[332]); + ZA[334] = ZMa(ZA[328], ZA[323], ZA[333]) + ZR30(ZA[333]); + ZA[81] = ZA[47] + ZA[70]; + ZA[101] = ZA[95] + K[32]; + + ZA[58] = ZR25(ZA[52]) + ZA[43]; + ZA[102] = ZR15(ZA[94]) + ZA[81]; + ZA[337] = ZA[318] + ZA[336]; + ZA[338] = ZA[336] + ZA[334]; + ZA[325] = ZA[322] + ZA[101]; + + ZA[341] = (ZCh(ZA[337], ZA[332], ZA[327]) + ZA[325]) + ZR26(ZA[337]); + ZA[339] = ZMa(ZA[333], ZA[328], ZA[338]) + ZR30(ZA[338]); + ZA[89] = ZA[58] + ZA[78]; + ZA[108] = ZA[102] + K[33]; + + ZA[59] = ZR25(ZA[48]) + ZA[52]; + ZA[103] = ZR15(ZA[95]) + ZA[89]; + ZA[342] = ZA[323] + ZA[341]; + ZA[343] = ZA[341] + ZA[339]; + ZA[330] = ZA[327] + ZA[108]; + + ZA[346] = (ZCh(ZA[342], ZA[337], ZA[332]) + ZA[330]) + ZR26(ZA[342]); + ZA[344] = ZMa(ZA[338], ZA[333], ZA[343]) + ZR30(ZA[343]); + ZA[90] = ZA[59] + ZA[79]; + ZA[109] = ZA[103] + K[34]; + + ZA[64] = ZR25(ZA[61]) + ZA[48]; + ZA[110] = ZR15(ZA[102]) + ZA[90]; + ZA[347] = ZA[328] + ZA[346]; + ZA[348] = ZA[346] + ZA[344]; + ZA[335] = ZA[332] + ZA[109]; + + ZA[351] = (ZCh(ZA[347], ZA[342], ZA[337]) + ZA[335]) + ZR26(ZA[347]); + ZA[349] = ZMa(ZA[343], ZA[338], ZA[348]) + ZR30(ZA[348]); + ZA[60] = ZR25(ZA[53]); + ZA[116] = ZA[110] + K[35]; + ZA[96] = ZA[87] + ZA[64]; + + ZA[111] = ZR15(ZA[103]) + ZA[96]; + ZA[353] = ZA[351] + ZA[349]; + ZA[352] = ZA[333] + ZA[351]; + ZA[340] = ZA[337] + ZA[116]; + ZA[65] = ZA[60] + ZA[61]; + + ZA[356] = (ZCh(ZA[352], ZA[347], ZA[342]) + ZA[340]) + ZR26(ZA[352]); + ZA[354] = ZMa(ZA[348], ZA[343], ZA[353]) + ZR30(ZA[353]); + ZA[97] = ZA[88] + ZA[65]; + ZA[117] = ZA[111] + K[36]; + + ZA[73] = ZR25(ZA[66]) + ZA[53]; + ZA[118] = ZR15(ZA[110]) + ZA[97]; + ZA[357] = ZA[338] + ZA[356]; + ZA[358] = ZA[356] + ZA[354]; + ZA[345] = ZA[342] + ZA[117]; + + ZA[361] = (ZCh(ZA[357], ZA[352], ZA[347]) + ZA[345]) + ZR26(ZA[357]); + ZA[359] = ZMa(ZA[353], ZA[348], ZA[358]) + ZR30(ZA[358]); + ZA[104] = ZA[73] + ZA[94]; + ZA[124] = ZA[118] + K[37]; + + ZA[74] = ZR25(ZA[67]) + ZA[66]; + ZA[119] = ZR15(ZA[111]) + ZA[104]; + ZA[362] = ZA[343] + ZA[361]; + ZA[363] = ZA[361] + ZA[359]; + ZA[350] = ZA[347] + ZA[124]; + + ZA[366] = (ZCh(ZA[362], ZA[357], ZA[352]) + ZA[350]) + ZR26(ZA[362]); + ZA[364] = ZMa(ZA[358], ZA[353], ZA[363]) + ZR30(ZA[363]); + ZA[105] = ZA[74] + ZA[95]; + ZA[125] = ZA[119] + K[38]; + + ZA[82] = ZR25(ZA[75]) + ZA[67]; + ZA[126] = ZR15(ZA[118]) + ZA[105]; + ZA[367] = ZA[348] + ZA[366]; + ZA[368] = ZA[366] + ZA[364]; + ZA[355] = ZA[352] + ZA[125]; + + ZA[371] = (ZCh(ZA[367], ZA[362], ZA[357]) + ZA[355]) + ZR26(ZA[367]); + ZA[369] = ZMa(ZA[363], ZA[358], ZA[368]) + ZR30(ZA[368]); + ZA[112] = ZA[102] + ZA[82]; + ZA[132] = ZA[126] + K[39]; + + ZA[83] = ZR25(ZA[70]) + ZA[75]; + ZA[127] = ZR15(ZA[119]) + ZA[112]; + ZA[372] = ZA[353] + ZA[371]; + ZA[373] = ZA[371] + ZA[369]; + ZA[360] = ZA[357] + ZA[132]; + + ZA[376] = (ZCh(ZA[372], ZA[367], ZA[362]) + ZA[360]) + ZR26(ZA[372]); + ZA[374] = ZMa(ZA[368], ZA[363], ZA[373]) + ZR30(ZA[373]); + ZA[113] = ZA[103] + ZA[83]; + ZA[133] = ZA[127] + K[40]; + + ZA[84] = ZR25(ZA[78]) + ZA[70]; + ZA[134] = ZR15(ZA[126]) + ZA[113]; + ZA[377] = ZA[358] + ZA[376]; + ZA[378] = ZA[376] + ZA[374]; + ZA[365] = ZA[362] + ZA[133]; + + ZA[381] = (ZCh(ZA[377], ZA[372], ZA[367]) + ZA[365]) + ZR26(ZA[377]); + ZA[379] = ZMa(ZA[373], ZA[368], ZA[378]) + ZR30(ZA[378]); + ZA[120] = ZA[110] + ZA[84]; + ZA[140] = ZA[134] + K[41]; + + ZA[91] = ZR25(ZA[79]) + ZA[78]; + ZA[135] = ZR15(ZA[127]) + ZA[120]; + ZA[382] = ZA[363] + ZA[381]; + ZA[383] = ZA[381] + ZA[379]; + ZA[370] = ZA[367] + ZA[140]; + + ZA[386] = (ZCh(ZA[382], ZA[377], ZA[372]) + ZA[370]) + ZR26(ZA[382]); + ZA[384] = ZMa(ZA[378], ZA[373], ZA[383]) + ZR30(ZA[383]); + ZA[121] = ZA[111] + ZA[91]; + ZA[141] = ZA[135] + K[42]; + + ZA[98] = ZR25(ZA[87]) + ZA[79]; + ZA[142] = ZR15(ZA[134]) + ZA[121]; + ZA[387] = ZA[368] + ZA[386]; + ZA[388] = ZA[386] + ZA[384]; + ZA[375] = ZA[372] + ZA[141]; + + ZA[391] = (ZCh(ZA[387], ZA[382], ZA[377]) + ZA[375]) + ZR26(ZA[387]); + ZA[389] = ZMa(ZA[383], ZA[378], ZA[388]) + ZR30(ZA[388]); + ZA[128] = ZA[118] + ZA[98]; + ZA[147] = ZA[142] + K[43]; + + ZA[99] = ZR25(ZA[88]) + ZA[87]; + ZA[143] = ZR15(ZA[135]) + ZA[128]; + ZA[392] = ZA[373] + ZA[391]; + ZA[393] = ZA[391] + ZA[389]; + ZA[380] = ZA[377] + ZA[147]; + + ZA[396] = (ZCh(ZA[392], ZA[387], ZA[382]) + ZA[380]) + ZR26(ZA[392]); + ZA[394] = ZMa(ZA[388], ZA[383], ZA[393]) + ZR30(ZA[393]); + ZA[129] = ZA[119] + ZA[99]; + ZA[148] = ZA[143] + K[44]; + + ZA[106] = ZR25(ZA[94]) + ZA[88]; + ZA[149] = ZR15(ZA[142]) + ZA[129]; + ZA[397] = ZA[378] + ZA[396]; + ZA[398] = ZA[396] + ZA[394]; + ZA[385] = ZA[382] + ZA[148]; + + ZA[401] = (ZCh(ZA[397], ZA[392], ZA[387]) + ZA[385]) + ZR26(ZA[397]); + ZA[399] = ZMa(ZA[393], ZA[388], ZA[398]) + ZR30(ZA[398]); + ZA[136] = ZA[126] + ZA[106]; + ZA[153] = ZA[149] + K[45]; + + ZA[107] = ZR25(ZA[95]) + ZA[94]; + ZA[150] = ZR15(ZA[143]) + ZA[136]; + ZA[402] = ZA[383] + ZA[401]; + ZA[403] = ZA[401] + ZA[399]; + ZA[390] = ZA[387] + ZA[153]; + + ZA[406] = (ZCh(ZA[402], ZA[397], ZA[392]) + ZA[390]) + ZR26(ZA[402]); + ZA[404] = ZMa(ZA[398], ZA[393], ZA[403]) + ZR30(ZA[403]); + ZA[137] = ZA[127] + ZA[107]; + ZA[154] = ZA[150] + K[46]; + + ZA[114] = ZR25(ZA[102]) + ZA[95]; + ZA[155] = ZR15(ZA[149]) + ZA[137]; + ZA[407] = ZA[388] + ZA[406]; + ZA[408] = ZA[406] + ZA[404]; + ZA[395] = ZA[392] + ZA[154]; + + ZA[411] = (ZCh(ZA[407], ZA[402], ZA[397]) + ZA[395]) + ZR26(ZA[407]); + ZA[409] = ZMa(ZA[403], ZA[398], ZA[408]) + ZR30(ZA[408]); + ZA[144] = ZA[134] + ZA[114]; + ZA[159] = ZA[155] + K[47]; + + ZA[115] = ZR25(ZA[103]) + ZA[102]; + ZA[156] = ZR15(ZA[150]) + ZA[144]; + ZA[412] = ZA[393] + ZA[411]; + ZA[413] = ZA[411] + ZA[409]; + ZA[400] = ZA[397] + ZA[159]; + + ZA[416] = (ZCh(ZA[412], ZA[407], ZA[402]) + ZA[400]) + ZR26(ZA[412]); + ZA[414] = ZMa(ZA[408], ZA[403], ZA[413]) + ZR30(ZA[413]); + ZA[145] = ZA[135] + ZA[115]; + ZA[160] = ZA[156] + K[48]; + + ZA[122] = ZR25(ZA[110]) + ZA[103]; + ZA[161] = ZR15(ZA[155]) + ZA[145]; + ZA[417] = ZA[398] + ZA[416]; + ZA[418] = ZA[416] + ZA[414]; + ZA[405] = ZA[402] + ZA[160]; + + ZA[421] = (ZCh(ZA[417], ZA[412], ZA[407]) + ZA[405]) + ZR26(ZA[417]); + ZA[419] = ZMa(ZA[413], ZA[408], ZA[418]) + ZR30(ZA[418]); + ZA[151] = ZA[142] + ZA[122]; + ZA[165] = ZA[161] + K[49]; + + ZA[123] = ZR25(ZA[111]) + ZA[110]; + ZA[162] = ZR15(ZA[156]) + ZA[151]; + ZA[422] = ZA[403] + ZA[421]; + ZA[423] = ZA[421] + ZA[419]; + ZA[410] = ZA[407] + ZA[165]; + + ZA[426] = (ZCh(ZA[422], ZA[417], ZA[412]) + ZA[410]) + ZR26(ZA[422]); + ZA[424] = ZMa(ZA[418], ZA[413], ZA[423]) + ZR30(ZA[423]); + ZA[152] = ZA[143] + ZA[123]; + ZA[166] = ZA[162] + K[50]; + + ZA[130] = ZR25(ZA[118]) + ZA[111]; + ZA[167] = ZR15(ZA[161]) + ZA[152]; + ZA[427] = ZA[408] + ZA[426]; + ZA[428] = ZA[426] + ZA[424]; + ZA[415] = ZA[412] + ZA[166]; + + ZA[431] = (ZCh(ZA[427], ZA[422], ZA[417]) + ZA[415]) + ZR26(ZA[427]); + ZA[429] = ZMa(ZA[423], ZA[418], ZA[428]) + ZR30(ZA[428]); + ZA[157] = ZA[149] + ZA[130]; + ZA[170] = ZA[167] + K[51]; + + ZA[131] = ZR25(ZA[119]) + ZA[118]; + ZA[168] = ZR15(ZA[162]) + ZA[157]; + ZA[432] = ZA[413] + ZA[431]; + ZA[433] = ZA[431] + ZA[429]; + ZA[420] = ZA[417] + ZA[170]; + + ZA[436] = (ZCh(ZA[432], ZA[427], ZA[422]) + ZA[420]) + ZR26(ZA[432]); + ZA[434] = ZMa(ZA[428], ZA[423], ZA[433]) + ZR30(ZA[433]); + ZA[158] = ZA[150] + ZA[131]; + ZA[171] = ZA[168] + K[52]; + + ZA[138] = ZR25(ZA[126]) + ZA[119]; + ZA[172] = ZR15(ZA[167]) + ZA[158]; + ZA[437] = ZA[418] + ZA[436]; + ZA[438] = ZA[436] + ZA[434]; + ZA[425] = ZA[422] + ZA[171]; + + ZA[441] = (ZCh(ZA[437], ZA[432], ZA[427]) + ZA[425]) + ZR26(ZA[437]); + ZA[439] = ZMa(ZA[433], ZA[428], ZA[438]) + ZR30(ZA[438]); + ZA[163] = ZA[155] + ZA[138]; + ZA[174] = ZA[172] + K[53]; + + ZA[139] = ZR25(ZA[127]) + ZA[126]; + ZA[173] = ZR15(ZA[168]) + ZA[163]; + ZA[442] = ZA[423] + ZA[441]; + ZA[443] = ZA[441] + ZA[439]; + ZA[430] = ZA[427] + ZA[174]; + + ZA[445] = (ZCh(ZA[442], ZA[437], ZA[432]) + ZA[430]) + ZR26(ZA[442]); + ZA[444] = ZMa(ZA[438], ZA[433], ZA[443]) + ZR30(ZA[443]); + ZA[164] = ZA[156] + ZA[139]; + ZA[175] = ZA[173] + K[54]; + + ZA[146] = ZR25(ZA[134]) + ZA[127]; + ZA[176] = ZR15(ZA[172]) + ZA[164]; + ZA[446] = ZA[428] + ZA[445]; + ZA[447] = ZA[445] + ZA[444]; + ZA[435] = ZA[432] + ZA[175]; + + ZA[449] = (ZCh(ZA[446], ZA[442], ZA[437]) + ZA[435]) + ZR26(ZA[446]); + ZA[448] = ZMa(ZA[443], ZA[438], ZA[447]) + ZR30(ZA[447]); + ZA[169] = ZA[161] + ZA[146]; + ZA[178] = ZA[176] + K[55]; + + ZA[177] = ZR15(ZA[173]) + ZA[169]; + ZA[451] = ZA[449] + ZA[448]; + ZA[450] = ZA[433] + ZA[449]; + ZA[440] = ZA[437] + ZA[178]; + + ZA[453] = (ZCh(ZA[450], ZA[446], ZA[442]) + ZA[440]) + ZR26(ZA[450]); + ZA[452] = ZMa(ZA[447], ZA[443], ZA[451]) + ZR30(ZA[451]); + ZA[179] = ZA[177] + K[56]; + + ZA[454] = ZA[438] + ZA[453]; + ZA[494] = ZA[442] + ZA[179]; + ZA[455] = ZA[453] + ZA[452]; + + ZA[457] = (ZCh(ZA[454], ZA[450], ZA[446]) + ZA[494]) + ZR26(ZA[454]); + ZA[456] = ZMa(ZA[451], ZA[447], ZA[455]) + ZR30(ZA[455]); + + ZA[459] = ZA[457] + ZA[456]; + + ZA[461] = ZA[455] + state1; + ZA[460] = ZA[459] + state0; + + ZA[495] = ZA[460] + K[57]; + ZA[469] = ZA[461] + K[58]; + + ZA[498] = (ZCh(ZA[495], K[59], K[60]) + ZA[469]) + ZR26(ZA[495]); + ZA[462] = ZA[451] + state2; + + ZA[496] = ZA[460] + K[61]; + ZA[506] = ZA[498] + K[62]; + ZA[470] = ZA[462] + K[63]; + + ZA[507] = (ZCh(ZA[506], ZA[495], K[59]) + ZA[470]) + ZR26(ZA[506]); + ZA[500] = ZMa(K[64], K[65], ZA[496]) + ZR30(ZA[496]); + ZA[463] = ZA[447] + state3; + + ZA[458] = ZA[443] + ZA[457]; + ZA[499] = ZA[498] + ZA[500]; + ZA[508] = ZA[507] + K[65]; + ZA[473] = ZA[463] + K[66]; + + ZA[510] = (ZCh(ZA[508], ZA[506], ZA[495]) + ZA[473]) + ZR26(ZA[508]); + ZA[928] = ZMa(ZA[496], K[64], ZA[499]) + ZR30(ZA[499]); + ZA[464] = ZA[458] + state4; + + ZA[476] = ZA[464] + ZA[460] + K[67]; + ZA[511] = ZA[510] + K[64]; + ZA[509] = ZA[928] + ZA[507]; + ZA[465] = ZA[454] + state5; + + ZA[514] = (ZCh(ZA[511], ZA[508], ZA[506]) + ZA[476]) + ZR26(ZA[511]); + ZA[512] = ZMa(ZA[499], ZA[496], ZA[509]) + ZR30(ZA[509]); + ZA[478] = ZA[465] + K[68]; + + ZA[519] = ZA[506] + ZA[478]; + ZA[516] = ZA[496] + ZA[514]; + ZA[513] = ZA[510] + ZA[512]; + ZA[466] = ZA[450] + state6; + + ZA[520] = (ZCh(ZA[516], ZA[511], ZA[508]) + ZA[519]) + ZR26(ZA[516]); + ZA[515] = ZMa(ZA[509], ZA[499], ZA[513]) + ZR30(ZA[513]); + ZA[480] = ZA[466] + K[69]; + + ZA[524] = ZA[508] + ZA[480]; + ZA[521] = ZA[499] + ZA[520]; + ZA[517] = ZA[514] + ZA[515]; + ZA[467] = ZA[446] + state7; + + ZA[525] = (ZCh(ZA[521], ZA[516], ZA[511]) + ZA[524]) + ZR26(ZA[521]); + ZA[522] = ZMa(ZA[513], ZA[509], ZA[517]) + ZR30(ZA[517]); + ZA[484] = ZA[467] + K[70]; + + ZA[529] = ZA[511] + ZA[484]; + ZA[526] = ZA[509] + ZA[525]; + ZA[523] = ZA[520] + ZA[522]; + + ZA[530] = (ZCh(ZA[526], ZA[521], ZA[516]) + ZA[529]) + ZR26(ZA[526]); + ZA[550] = ZMa(ZA[517], ZA[513], ZA[523]) + ZR30(ZA[523]); + + ZA[531] = ZA[513] + ZA[530]; + ZA[533] = ZA[516] + K[71]; + ZA[527] = ZA[550] + ZA[525]; + + ZA[534] = (ZCh(ZA[531], ZA[526], ZA[521]) + ZA[533]) + ZR26(ZA[531]); + ZA[551] = ZMa(ZA[523], ZA[517], ZA[527]) + ZR30(ZA[527]); + + ZA[535] = ZA[517] + ZA[534]; + ZA[538] = ZA[521] + K[1]; + ZA[532] = ZA[551] + ZA[530]; + + ZA[539] = (ZCh(ZA[535], ZA[531], ZA[526]) + ZA[538]) + ZR26(ZA[535]); + ZA[552] = ZMa(ZA[527], ZA[523], ZA[532]) + ZR30(ZA[532]); + + ZA[540] = ZA[523] + ZA[539]; + ZA[542] = ZA[526] + K[2]; + ZA[536] = ZA[552] + ZA[534]; + + ZA[543] = (ZCh(ZA[540], ZA[535], ZA[531]) + ZA[542]) + ZR26(ZA[540]); + ZA[553] = ZMa(ZA[532], ZA[527], ZA[536]) + ZR30(ZA[536]); + + ZA[544] = ZA[527] + ZA[543]; + ZA[555] = ZA[531] + K[3]; + ZA[541] = ZA[553] + ZA[539]; + + ZA[558] = (ZCh(ZA[544], ZA[540], ZA[535]) + ZA[555]) + ZR26(ZA[544]); + ZA[547] = ZMa(ZA[536], ZA[532], ZA[541]) + ZR30(ZA[541]); + + ZA[559] = ZA[532] + ZA[558]; + ZA[556] = ZA[535] + K[4]; + ZA[545] = ZA[547] + ZA[543]; + + ZA[562] = (ZCh(ZA[559], ZA[544], ZA[540]) + ZA[556]) + ZR26(ZA[559]); + ZA[561] = ZMa(ZA[541], ZA[536], ZA[545]) + ZR30(ZA[545]); + + ZA[563] = ZA[536] + ZA[562]; + ZA[560] = ZA[561] + ZA[558]; + ZA[557] = ZA[540] + K[5]; + + ZA[568] = (ZCh(ZA[563], ZA[559], ZA[544]) + ZA[557]) + ZR26(ZA[563]); + ZA[564] = ZMa(ZA[545], ZA[541], ZA[560]) + ZR30(ZA[560]); + + ZA[569] = ZA[541] + ZA[568]; + ZA[572] = ZA[544] + K[6]; + ZA[565] = ZA[562] + ZA[564]; + + ZA[574] = (ZCh(ZA[569], ZA[563], ZA[559]) + ZA[572]) + ZR26(ZA[569]); + ZA[570] = ZMa(ZA[560], ZA[545], ZA[565]) + ZR30(ZA[565]); + ZA[468] = ZR25(ZA[461]); + + ZA[497] = ZA[468] + ZA[460]; + ZA[575] = ZA[545] + ZA[574]; + ZA[571] = ZA[568] + ZA[570]; + ZA[573] = ZA[559] + K[72]; + + ZA[578] = (ZCh(ZA[575], ZA[569], ZA[563]) + ZA[573]) + ZR26(ZA[575]); + ZA[576] = ZMa(ZA[565], ZA[560], ZA[571]) + ZR30(ZA[571]); + ZA[929] = ZR25(ZA[462]); + ZA[503] = ZA[497] + 0xe49b69c1U; + + ZA[471] = ZA[929] + ZA[461] + K[74]; + ZA[582] = ZA[563] + ZA[503]; + ZA[579] = ZA[560] + ZA[578]; + ZA[577] = ZA[574] + ZA[576]; + + ZA[583] = (ZCh(ZA[579], ZA[575], ZA[569]) + ZA[582]) + ZR26(ZA[579]); + ZA[580] = ZMa(ZA[571], ZA[565], ZA[577]) + ZR30(ZA[577]); + ZA[488] = ZA[471] + K[75]; + + ZA[472] = ZR25(ZA[463]) + ZA[462]; + ZA[587] = ZA[569] + ZA[488]; + ZA[584] = ZA[565] + ZA[583]; + ZA[581] = ZA[578] + ZA[580]; + + ZA[588] = (ZCh(ZA[584], ZA[579], ZA[575]) + ZA[587]) + ZR26(ZA[584]); + ZA[586] = ZMa(ZA[577], ZA[571], ZA[581]) + ZR30(ZA[581]); + ZA[501] = ZR15(ZA[497]) + ZA[472]; + ZA[475] = ZR15(ZA[471]); + ZA[926] = ZA[575] + K[8]; + + ZA[474] = ZA[475] + ZA[463] + ZR25(ZA[464]); + ZA[927] = ZA[926] + ZA[501]; + ZA[589] = ZA[571] + ZA[588]; + ZA[585] = ZA[583] + ZA[586]; + + ZA[592] = (ZCh(ZA[589], ZA[584], ZA[579]) + ZA[927]) + ZR26(ZA[589]); + ZA[590] = ZMa(ZA[581], ZA[577], ZA[585]) + ZR30(ZA[585]); + ZA[477] = ZR25(ZA[465]) + ZA[464]; + ZA[489] = ZA[474] + K[9]; + + ZA[518] = ZR15(ZA[501]) + ZA[477]; + ZA[479] = ZR25(ZA[466]); + ZA[596] = ZA[579] + ZA[489]; + ZA[593] = ZA[577] + ZA[592]; + ZA[591] = ZA[588] + ZA[590]; + + ZA[597] = (ZCh(ZA[593], ZA[589], ZA[584]) + ZA[596]) + ZR26(ZA[593]); + ZA[594] = ZMa(ZA[585], ZA[581], ZA[591]) + ZR30(ZA[591]); + ZA[481] = ZA[479] + ZA[465]; + ZA[601] = ZA[518] + K[11]; + + ZA[482] = ZR15(ZA[474]) + ZA[481]; + ZA[602] = ZA[584] + ZA[601]; + ZA[598] = ZA[581] + ZA[597]; + ZA[595] = ZA[592] + ZA[594]; + + ZA[632] = (ZCh(ZA[598], ZA[593], ZA[589]) + ZA[602]) + ZR26(ZA[598]); + ZA[599] = ZMa(ZA[591], ZA[585], ZA[595]) + ZR30(ZA[595]); + ZA[483] = ZA[466] + K[76] + ZR25(ZA[467]); + ZA[490] = ZA[482] + K[12]; + + ZA[528] = ZR15(ZA[518]) + ZA[483]; + ZA[736] = ZA[585] + ZA[632]; + ZA[605] = ZA[589] + ZA[490]; + ZA[600] = ZA[597] + ZA[599]; + ZA[485] = ZA[467] + K[77]; + + ZA[738] = (ZCh(ZA[736], ZA[598], ZA[593]) + ZA[605]) + ZR26(ZA[736]); + ZA[744] = ZMa(ZA[595], ZA[591], ZA[600]) + ZR30(ZA[600]); + ZA[487] = ZR15(ZA[482]) + ZA[485]; + ZA[603] = ZA[528] + K[14]; + + ZA[502] = ZA[497] + ZA[487]; + ZA[739] = ZA[591] + ZA[738]; + ZA[604] = ZA[593] + ZA[603]; + ZA[737] = ZA[744] + ZA[632]; + + ZA[741] = (ZCh(ZA[739], ZA[736], ZA[598]) + ZA[604]) + ZR26(ZA[739]); + ZA[745] = ZMa(ZA[600], ZA[595], ZA[737]) + ZR30(ZA[737]); + ZA[486] = ZA[471] + K[10]; + ZA[606] = ZA[502] + K[15]; + + ZA[537] = ZR15(ZA[528]) + ZA[486]; + ZA[742] = ZA[595] + ZA[741]; + ZA[613] = ZA[598] + ZA[606]; + ZA[740] = ZA[745] + ZA[738]; + + ZA[747] = (ZCh(ZA[742], ZA[739], ZA[736]) + ZA[613]) + ZR26(ZA[742]); + ZA[746] = ZMa(ZA[737], ZA[600], ZA[740]) + ZR30(ZA[740]); + ZA[607] = ZA[537] + K[16]; + + ZA[546] = ZR15(ZA[502]) + ZA[501]; + ZA[751] = ZA[736] + ZA[607]; + ZA[748] = ZA[600] + ZA[747]; + ZA[743] = ZA[746] + ZA[741]; + + ZA[752] = (ZCh(ZA[748], ZA[742], ZA[739]) + ZA[751]) + ZR26(ZA[748]); + ZA[749] = ZMa(ZA[740], ZA[737], ZA[743]) + ZR30(ZA[743]); + ZA[608] = ZA[546] + K[17]; + + ZA[554] = ZR15(ZA[537]) + ZA[474]; + ZA[756] = ZA[739] + ZA[608]; + ZA[753] = ZA[737] + ZA[752]; + ZA[750] = ZA[747] + ZA[749]; + + ZA[757] = (ZCh(ZA[753], ZA[748], ZA[742]) + ZA[756]) + ZR26(ZA[753]); + ZA[754] = ZMa(ZA[743], ZA[740], ZA[750]) + ZR30(ZA[750]); + ZA[609] = ZA[554] + K[18]; + + ZA[566] = ZR15(ZA[546]) + ZA[518]; + ZA[761] = ZA[742] + ZA[609]; + ZA[758] = ZA[740] + ZA[757]; + ZA[755] = ZA[752] + ZA[754]; + + ZA[762] = (ZCh(ZA[758], ZA[753], ZA[748]) + ZA[761]) + ZR26(ZA[758]); + ZA[759] = ZMa(ZA[750], ZA[743], ZA[755]) + ZR30(ZA[755]); + ZA[610] = ZA[566] + K[19]; + + ZA[567] = ZR15(ZA[554]) + ZA[482]; + ZA[766] = ZA[748] + ZA[610]; + ZA[763] = ZA[743] + ZA[762]; + ZA[760] = ZA[757] + ZA[759]; + + ZA[767] = (ZCh(ZA[763], ZA[758], ZA[753]) + ZA[766]) + ZR26(ZA[763]); + ZA[764] = ZMa(ZA[755], ZA[750], ZA[760]) + ZR30(ZA[760]); + ZA[611] = ZA[567] + K[20]; + + ZA[614] = ZR15(ZA[566]) + ZA[528]; + ZA[771] = ZA[753] + ZA[611]; + ZA[768] = ZA[750] + ZA[767]; + ZA[765] = ZA[762] + ZA[764]; + + ZA[772] = (ZCh(ZA[768], ZA[763], ZA[758]) + ZA[771]) + ZR26(ZA[768]); + ZA[769] = ZMa(ZA[760], ZA[755], ZA[765]) + ZR30(ZA[765]); + ZA[612] = ZA[502] + K[78]; + ZA[615] = ZA[614] + K[22]; + + ZA[616] = ZR15(ZA[567]) + ZA[612]; + ZA[504] = ZR25(ZA[497]) + K[76]; + ZA[776] = ZA[758] + ZA[615]; + ZA[773] = ZA[755] + ZA[772]; + ZA[770] = ZA[767] + ZA[769]; + + ZA[777] = (ZCh(ZA[773], ZA[768], ZA[763]) + ZA[776]) + ZR26(ZA[773]); + ZA[774] = ZMa(ZA[765], ZA[760], ZA[770]) + ZR30(ZA[770]); + ZA[492] = ZR25(ZA[471]); + ZA[618] = ZA[537] + ZA[504]; + ZA[617] = ZA[616] + K[23]; + + ZA[619] = ZR15(ZA[614]) + ZA[618]; + ZA[781] = ZA[763] + ZA[617]; + ZA[778] = ZA[760] + ZA[777]; + ZA[775] = ZA[772] + ZA[774]; + ZA[505] = ZA[492] + ZA[497]; + + ZA[782] = (ZCh(ZA[778], ZA[773], ZA[768]) + ZA[781]) + ZR26(ZA[778]); + ZA[779] = ZMa(ZA[770], ZA[765], ZA[775]) + ZR30(ZA[775]); + ZA[621] = ZA[505] + ZA[546]; + ZA[620] = ZA[619] + K[24]; + + ZA[622] = ZR15(ZA[616]) + ZA[621]; + ZA[625] = ZR25(ZA[501]); + ZA[786] = ZA[768] + ZA[620]; + ZA[783] = ZA[765] + ZA[782]; + ZA[624] = ZA[554] + ZA[471]; + ZA[780] = ZA[777] + ZA[779]; + + ZA[787] = (ZCh(ZA[783], ZA[778], ZA[773]) + ZA[786]) + ZR26(ZA[783]); + ZA[784] = ZMa(ZA[775], ZA[770], ZA[780]) + ZR30(ZA[780]); + ZA[493] = ZR25(ZA[474]); + ZA[626] = ZA[625] + ZA[624]; + ZA[623] = ZA[622] + K[25]; + + ZA[627] = ZR15(ZA[619]) + ZA[626]; + ZA[791] = ZA[773] + ZA[623]; + ZA[788] = ZA[770] + ZA[787]; + ZA[785] = ZA[782] + ZA[784]; + ZA[629] = ZA[493] + ZA[501]; + + ZA[792] = (ZCh(ZA[788], ZA[783], ZA[778]) + ZA[791]) + ZR26(ZA[788]); + ZA[789] = ZMa(ZA[780], ZA[775], ZA[785]) + ZR30(ZA[785]); + ZA[630] = ZA[566] + ZA[629]; + ZA[628] = ZA[627] + K[26]; + + ZA[634] = ZR25(ZA[518]) + ZA[474]; + ZA[631] = ZR15(ZA[622]) + ZA[630]; + ZA[796] = ZA[778] + ZA[628]; + ZA[793] = ZA[775] + ZA[792]; + ZA[790] = ZA[787] + ZA[789]; + + ZA[797] = (ZCh(ZA[793], ZA[788], ZA[783]) + ZA[796]) + ZR26(ZA[793]); + ZA[794] = ZMa(ZA[785], ZA[780], ZA[790]) + ZR30(ZA[790]); + ZA[491] = ZR25(ZA[482]); + ZA[635] = ZA[567] + ZA[634]; + ZA[633] = ZA[631] + K[27]; + + ZA[636] = ZR15(ZA[627]) + ZA[635]; + ZA[801] = ZA[783] + ZA[633]; + ZA[798] = ZA[780] + ZA[797]; + ZA[795] = ZA[792] + ZA[794]; + ZA[638] = ZA[491] + ZA[518]; + + ZA[802] = (ZCh(ZA[798], ZA[793], ZA[788]) + ZA[801]) + ZR26(ZA[798]); + ZA[799] = ZMa(ZA[790], ZA[785], ZA[795]) + ZR30(ZA[795]); + ZA[639] = ZA[638] + ZA[614]; + ZA[637] = ZA[636] + K[28]; + + ZA[642] = ZR25(ZA[528]) + ZA[482]; + ZA[640] = ZR15(ZA[631]) + ZA[639]; + ZA[806] = ZA[788] + ZA[637]; + ZA[803] = ZA[785] + ZA[802]; + ZA[800] = ZA[797] + ZA[799]; + + ZA[807] = (ZCh(ZA[803], ZA[798], ZA[793]) + ZA[806]) + ZR26(ZA[803]); + ZA[804] = ZMa(ZA[795], ZA[790], ZA[800]) + ZR30(ZA[800]); + ZA[643] = ZA[616] + ZA[642]; + ZA[641] = ZA[640] + K[29]; + + ZA[646] = ZR25(ZA[502]) + ZA[528]; + ZA[644] = ZR15(ZA[636]) + ZA[643]; + ZA[811] = ZA[793] + ZA[641]; + ZA[808] = ZA[790] + ZA[807]; + ZA[805] = ZA[802] + ZA[804]; + + ZA[812] = (ZCh(ZA[808], ZA[803], ZA[798]) + ZA[811]) + ZR26(ZA[808]); + ZA[809] = ZMa(ZA[800], ZA[795], ZA[805]) + ZR30(ZA[805]); + ZA[647] = ZA[619] + ZA[646]; + ZA[645] = ZA[644] + K[30]; + + ZA[650] = ZR25(ZA[537]) + ZA[502]; + ZA[648] = ZR15(ZA[640]) + ZA[647]; + ZA[816] = ZA[798] + ZA[645]; + ZA[813] = ZA[795] + ZA[812]; + ZA[810] = ZA[807] + ZA[809]; + + ZA[817] = (ZCh(ZA[813], ZA[808], ZA[803]) + ZA[816]) + ZR26(ZA[813]); + ZA[814] = ZMa(ZA[805], ZA[800], ZA[810]) + ZR30(ZA[810]); + ZA[925] = ZA[622] + ZA[650]; + ZA[649] = ZA[648] + K[31]; + + ZA[653] = ZR25(ZA[546]) + ZA[537]; + ZA[651] = ZR15(ZA[644]) + ZA[925]; + ZA[821] = ZA[803] + ZA[649]; + ZA[818] = ZA[800] + ZA[817]; + ZA[815] = ZA[812] + ZA[814]; + + ZA[822] = (ZCh(ZA[818], ZA[813], ZA[808]) + ZA[821]) + ZR26(ZA[818]); + ZA[819] = ZMa(ZA[810], ZA[805], ZA[815]) + ZR30(ZA[815]); + ZA[654] = ZA[627] + ZA[653]; + ZA[652] = ZA[651] + K[32]; + + ZA[657] = ZR25(ZA[554]) + ZA[546]; + ZA[655] = ZR15(ZA[648]) + ZA[654]; + ZA[826] = ZA[808] + ZA[652]; + ZA[823] = ZA[805] + ZA[822]; + ZA[820] = ZA[817] + ZA[819]; + + ZA[827] = (ZCh(ZA[823], ZA[818], ZA[813]) + ZA[826]) + ZR26(ZA[823]); + ZA[824] = ZMa(ZA[815], ZA[810], ZA[820]) + ZR30(ZA[820]); + ZA[658] = ZA[631] + ZA[657]; + ZA[656] = ZA[655] + K[33]; + + ZA[661] = ZR25(ZA[566]) + ZA[554]; + ZA[659] = ZR15(ZA[651]) + ZA[658]; + ZA[831] = ZA[813] + ZA[656]; + ZA[828] = ZA[810] + ZA[827]; + ZA[825] = ZA[822] + ZA[824]; + + ZA[832] = (ZCh(ZA[828], ZA[823], ZA[818]) + ZA[831]) + ZR26(ZA[828]); + ZA[829] = ZMa(ZA[820], ZA[815], ZA[825]) + ZR30(ZA[825]); + ZA[662] = ZA[636] + ZA[661]; + ZA[660] = ZA[659] + K[34]; + + ZA[665] = ZR25(ZA[567]) + ZA[566]; + ZA[663] = ZR15(ZA[655]) + ZA[662]; + ZA[836] = ZA[818] + ZA[660]; + ZA[833] = ZA[815] + ZA[832]; + ZA[830] = ZA[827] + ZA[829]; + + ZA[837] = (ZCh(ZA[833], ZA[828], ZA[823]) + ZA[836]) + ZR26(ZA[833]); + ZA[834] = ZMa(ZA[825], ZA[820], ZA[830]) + ZR30(ZA[830]); + ZA[666] = ZA[640] + ZA[665]; + ZA[664] = ZA[663] + K[35]; + + ZA[669] = ZR25(ZA[614]) + ZA[567]; + ZA[667] = ZR15(ZA[659]) + ZA[666]; + ZA[841] = ZA[823] + ZA[664]; + ZA[838] = ZA[820] + ZA[837]; + ZA[835] = ZA[832] + ZA[834]; + + ZA[842] = (ZCh(ZA[838], ZA[833], ZA[828]) + ZA[841]) + ZR26(ZA[838]); + ZA[839] = ZMa(ZA[830], ZA[825], ZA[835]) + ZR30(ZA[835]); + ZA[670] = ZA[644] + ZA[669]; + ZA[668] = ZA[667] + K[36]; + + ZA[677] = ZR25(ZA[616]) + ZA[614]; + ZA[671] = ZR15(ZA[663]) + ZA[670]; + ZA[846] = ZA[828] + ZA[668]; + ZA[843] = ZA[825] + ZA[842]; + ZA[840] = ZA[837] + ZA[839]; + + ZA[847] = (ZCh(ZA[843], ZA[838], ZA[833]) + ZA[846]) + ZR26(ZA[843]); + ZA[844] = ZMa(ZA[835], ZA[830], ZA[840]) + ZR30(ZA[840]); + ZA[678] = ZA[648] + ZA[677]; + ZA[676] = ZA[671] + K[37]; + + ZA[682] = ZR25(ZA[619]) + ZA[616]; + ZA[679] = ZR15(ZA[667]) + ZA[678]; + ZA[851] = ZA[833] + ZA[676]; + ZA[848] = ZA[830] + ZA[847]; + ZA[845] = ZA[842] + ZA[844]; + + ZA[852] = (ZCh(ZA[848], ZA[843], ZA[838]) + ZA[851]) + ZR26(ZA[848]); + ZA[849] = ZMa(ZA[840], ZA[835], ZA[845]) + ZR30(ZA[845]); + ZA[683] = ZA[651] + ZA[682]; + ZA[680] = ZA[679] + K[38]; + + ZA[686] = ZR25(ZA[622]) + ZA[619]; + ZA[684] = ZR15(ZA[671]) + ZA[683]; + ZA[856] = ZA[838] + ZA[680]; + ZA[853] = ZA[835] + ZA[852]; + ZA[850] = ZA[847] + ZA[849]; + + ZA[857] = (ZCh(ZA[853], ZA[848], ZA[843]) + ZA[856]) + ZR26(ZA[853]); + ZA[854] = ZMa(ZA[845], ZA[840], ZA[850]) + ZR30(ZA[850]); + ZA[687] = ZA[655] + ZA[686]; + ZA[685] = ZA[684] + K[39]; + + ZA[690] = ZR25(ZA[627]) + ZA[622]; + ZA[688] = ZR15(ZA[679]) + ZA[687]; + ZA[861] = ZA[843] + ZA[685]; + ZA[858] = ZA[840] + ZA[857]; + ZA[855] = ZA[852] + ZA[854]; + + ZA[862] = (ZCh(ZA[858], ZA[853], ZA[848]) + ZA[861]) + ZR26(ZA[858]); + ZA[859] = ZMa(ZA[850], ZA[845], ZA[855]) + ZR30(ZA[855]); + ZA[691] = ZA[659] + ZA[690]; + ZA[689] = ZA[688] + K[40]; + + ZA[694] = ZR25(ZA[631]) + ZA[627]; + ZA[692] = ZR15(ZA[684]) + ZA[691]; + ZA[866] = ZA[848] + ZA[689]; + ZA[863] = ZA[845] + ZA[862]; + ZA[860] = ZA[857] + ZA[859]; + + ZA[867] = (ZCh(ZA[863], ZA[858], ZA[853]) + ZA[866]) + ZR26(ZA[863]); + ZA[864] = ZMa(ZA[855], ZA[850], ZA[860]) + ZR30(ZA[860]); + ZA[695] = ZA[663] + ZA[694]; + ZA[693] = ZA[692] + K[41]; + + ZA[698] = ZR25(ZA[636]) + ZA[631]; + ZA[696] = ZR15(ZA[688]) + ZA[695]; + ZA[871] = ZA[853] + ZA[693]; + ZA[868] = ZA[850] + ZA[867]; + ZA[865] = ZA[862] + ZA[864]; + + ZA[873] = (ZCh(ZA[868], ZA[863], ZA[858]) + ZA[871]) + ZR26(ZA[868]); + ZA[869] = ZMa(ZA[860], ZA[855], ZA[865]) + ZR30(ZA[865]); + ZA[699] = ZA[667] + ZA[698]; + ZA[697] = ZA[696] + K[42]; + + ZA[702] = ZR25(ZA[640]) + ZA[636]; + ZA[700] = ZR15(ZA[692]) + ZA[699]; + ZA[877] = ZA[858] + ZA[697]; + ZA[874] = ZA[855] + ZA[873]; + ZA[870] = ZA[867] + ZA[869]; + + ZA[878] = (ZCh(ZA[874], ZA[868], ZA[863]) + ZA[877]) + ZR26(ZA[874]); + ZA[875] = ZMa(ZA[865], ZA[860], ZA[870]) + ZR30(ZA[870]); + ZA[703] = ZA[671] + ZA[702]; + ZA[701] = ZA[700] + K[43]; + + ZA[706] = ZR25(ZA[644]) + ZA[640]; + ZA[704] = ZR15(ZA[696]) + ZA[703]; + ZA[882] = ZA[863] + ZA[701]; + ZA[879] = ZA[860] + ZA[878]; + ZA[876] = ZA[873] + ZA[875]; + + ZA[883] = (ZCh(ZA[879], ZA[874], ZA[868]) + ZA[882]) + ZR26(ZA[879]); + ZA[880] = ZMa(ZA[870], ZA[865], ZA[876]) + ZR30(ZA[876]); + ZA[707] = ZA[679] + ZA[706]; + ZA[705] = ZA[704] + K[44]; + + ZA[710] = ZR25(ZA[648]) + ZA[644]; + ZA[708] = ZR15(ZA[700]) + ZA[707]; + ZA[887] = ZA[868] + ZA[705]; + ZA[884] = ZA[865] + ZA[883]; + ZA[881] = ZA[878] + ZA[880]; + + ZA[888] = (ZCh(ZA[884], ZA[879], ZA[874]) + ZA[887]) + ZR26(ZA[884]); + ZA[885] = ZMa(ZA[876], ZA[870], ZA[881]) + ZR30(ZA[881]); + ZA[711] = ZA[684] + ZA[710]; + ZA[709] = ZA[708] + K[45]; + + ZA[714] = ZR25(ZA[651]) + ZA[648]; + ZA[712] = ZR15(ZA[704]) + ZA[711]; + ZA[892] = ZA[874] + ZA[709]; + ZA[889] = ZA[870] + ZA[888]; + ZA[886] = ZA[883] + ZA[885]; + + ZA[893] = (ZCh(ZA[889], ZA[884], ZA[879]) + ZA[892]) + ZR26(ZA[889]); + ZA[890] = ZMa(ZA[881], ZA[876], ZA[886]) + ZR30(ZA[886]); + ZA[715] = ZA[688] + ZA[714]; + ZA[713] = ZA[712] + K[46]; + + ZA[718] = ZR25(ZA[655]) + ZA[651]; + ZA[716] = ZR15(ZA[708]) + ZA[715]; + ZA[897] = ZA[879] + ZA[713]; + ZA[894] = ZA[876] + ZA[893]; + ZA[891] = ZA[888] + ZA[890]; + + ZA[898] = (ZCh(ZA[894], ZA[889], ZA[884]) + ZA[897]) + ZR26(ZA[894]); + ZA[895] = ZMa(ZA[886], ZA[881], ZA[891]) + ZR30(ZA[891]); + ZA[719] = ZA[692] + ZA[718]; + ZA[717] = ZA[716] + K[47]; + + ZA[722] = ZR25(ZA[659]) + ZA[655]; + ZA[720] = ZR15(ZA[712]) + ZA[719]; + ZA[902] = ZA[884] + ZA[717]; + ZA[899] = ZA[881] + ZA[898]; + ZA[896] = ZA[893] + ZA[895]; + + ZA[903] = (ZCh(ZA[899], ZA[894], ZA[889]) + ZA[902]) + ZR26(ZA[899]); + ZA[900] = ZMa(ZA[891], ZA[886], ZA[896]) + ZR30(ZA[896]); + ZA[723] = ZA[696] + ZA[722]; + ZA[721] = ZA[720] + K[48]; + + ZA[672] = ZR25(ZA[663]) + ZA[659]; + ZA[724] = ZR15(ZA[716]) + ZA[723]; + ZA[907] = ZA[889] + ZA[721]; + ZA[904] = ZA[886] + ZA[903]; + ZA[901] = ZA[898] + ZA[900]; + + ZA[908] = (ZCh(ZA[904], ZA[899], ZA[894]) + ZA[907]) + ZR26(ZA[904]); + ZA[905] = ZMa(ZA[896], ZA[891], ZA[901]) + ZR30(ZA[901]); + ZA[673] = ZR25(ZA[667]) + ZA[663]; + ZA[726] = ZA[700] + ZA[672]; + ZA[725] = ZA[724] + K[49]; + + ZA[727] = ZR15(ZA[720]) + ZA[726]; + ZA[912] = ZA[894] + ZA[725]; + ZA[909] = ZA[891] + ZA[908]; + ZA[906] = ZA[903] + ZA[905]; + ZA[675] = ZA[667] + K[52]; + ZA[729] = ZA[704] + ZA[673]; + + ZA[913] = (ZCh(ZA[909], ZA[904], ZA[899]) + ZA[912]) + ZR26(ZA[909]); + ZA[910] = ZMa(ZA[901], ZA[896], ZA[906]) + ZR30(ZA[906]); + ZA[674] = ZR25(ZA[671]) + ZA[675]; + ZA[730] = ZR15(ZA[724]) + ZA[729]; + ZA[728] = ZA[727] + K[50]; + + ZA[681] = ZR25(ZA[679]) + ZA[671]; + ZA[917] = ZA[899] + ZA[901] + ZA[728]; + ZA[914] = ZA[896] + ZA[913]; + ZA[911] = ZA[908] + ZA[910]; + ZA[732] = ZA[708] + ZA[674]; + ZA[731] = ZA[730] + K[51]; + + ZA[918] = (ZCh(ZA[914], ZA[909], ZA[904]) + ZA[917]) + ZR26(ZA[914]); + ZA[915] = ZMa(ZA[906], ZA[901], ZA[911]) + ZR30(ZA[911]); + ZA[733] = ZR15(ZA[727]) + ZA[732]; + ZA[919] = ZA[906] + ZA[904] + ZA[731]; + ZA[734] = ZA[712] + ZA[681]; + + ZA[920] = (ZCh(ZA[918], ZA[914], ZA[909]) + ZA[919]) + ZR26(ZA[918]); + ZA[735] = ZR15(ZA[730]) + ZA[734]; + ZA[921] = ZA[911] + ZA[909] + ZA[733]; + ZA[916] = ZA[913] + ZA[915]; + + ZA[922] = (ZCh(ZA[920], ZA[918], ZA[914]) + ZA[921]) + ZR26(ZA[920]); + ZA[923] = ZA[916] + ZA[914] + ZA[735]; + + ZA[924] = (ZCh(ZA[922], ZA[920], ZA[918]) + ZA[923]) + ZR26(ZA[922]); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#if defined(VECTORS4) + bool result = any(ZA[924] == K[79]); + + if (result) { + if (ZA[924].x == K[79]) + SETFOUND(Znonce.x); + if (ZA[924].y == K[79]) + SETFOUND(Znonce.y); + if (ZA[924].z == K[79]) + SETFOUND(Znonce.z); + if (ZA[924].w == K[79]) + SETFOUND(Znonce.w); + } +#elif defined(VECTORS2) + bool result = any(ZA[924] == K[79]); + + if (result) { + if (ZA[924].x == K[79]) + SETFOUND(Znonce.x); + if (ZA[924].y == K[79]) + SETFOUND(Znonce.y); + } +#else + if (ZA[924] == K[79]) + SETFOUND(Znonce); +#endif +} diff --git a/bfgminer3.9/share/bfgminer/opencl/diakgcn121016.cl b/bfgminer3.9/share/bfgminer/opencl/diakgcn121016.cl new file mode 100644 index 0000000..b87fbde --- /dev/null +++ b/bfgminer3.9/share/bfgminer/opencl/diakgcn121016.cl @@ -0,0 +1,599 @@ +// DiaKGCN 27-04-2012 - OpenCL kernel by Diapolo +// +// Parts and / or ideas for this kernel are based upon the public-domain poclbm project, the phatk kernel by Phateus and the DiabloMiner kernel by DiabloD3. +// The kernel was rewritten by me (Diapolo) and is still public-domain! + +#ifdef VECTORS4 + typedef uint4 u; +#elif defined VECTORS2 + typedef uint2 u; +#else + typedef uint u; +#endif + +#ifdef BITALIGN + #pragma OPENCL EXTENSION cl_amd_media_ops : enable + #ifdef BFI_INT + #define ch(x, y, z) amd_bytealign(x, y, z) + #define ma(x, y, z) amd_bytealign(z ^ x, y, x) + #else + #define ch(x, y, z) bitselect(z, y, x) + #define ma(z, x, y) bitselect(z, y, z ^ x) + #endif +#else + #define ch(x, y, z) (z ^ (x & (y ^ z))) + #define ma(x, y, z) ((x & z) | (y & (x | z))) +#endif + +#define rotr15(n) (rotate(n, 15U) ^ rotate(n, 13U) ^ (n >> 10U)) +#define rotr25(n) (rotate(n, 25U) ^ rotate(n, 14U) ^ (n >> 3U)) +#define rotr26(n) (rotate(n, 26U) ^ rotate(n, 21U) ^ rotate(n, 7U)) +#define rotr30(n) (rotate(n, 30U) ^ rotate(n, 19U) ^ rotate(n, 10U)) + +__kernel + __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) + void search( +#ifndef GOFFSET + const u base, +#endif + const uint PreVal0, const uint PreVal4, + const uint H1, const uint D1A, const uint B1, const uint C1, + const uint F1, const uint G1, const uint C1addK5, const uint B1addK6, const uint PreVal0addK7, + const uint W16addK16, const uint W17addK17, + const uint PreW18, const uint PreW19, + const uint W16, const uint W17, + const uint PreW31, const uint PreW32, + const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + const uint state0A, const uint state0B, + const uint state1A, const uint state2A, const uint state3A, const uint state4A, + const uint state5A, const uint state6A, const uint state7A, + volatile __global uint * output) +{ + u V[8]; + u W[16]; + +#ifdef VECTORS4 + const u nonce = (uint)(get_local_id(0)) * 4U + (uint)(get_group_id(0)) * (uint)(WORKVEC) + base; +#elif defined VECTORS2 + const u nonce = (uint)(get_local_id(0)) * 2U + (uint)(get_group_id(0)) * (uint)(WORKVEC) + base; +#else + #ifdef GOFFSET + const u nonce = (uint)(get_global_id(0)); + #else + const u nonce = (uint)(get_local_id(0)) + (uint)(get_group_id(0)) * (uint)(WORKSIZE) + base; + #endif +#endif + + V[0] = PreVal0 + nonce; + V[1] = B1; + V[2] = C1; + V[3] = D1A; + V[4] = PreVal4 + nonce; + V[5] = F1; + V[6] = G1; + V[7] = H1; + + V[7] += V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += C1addK5 + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = C1addK5 + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += B1addK6 + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = B1addK6 + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += PreVal0addK7 + nonce + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = PreVal0addK7 + nonce + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0xd807aa98U + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0xd807aa98U + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x12835b01U + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x12835b01U + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x243185beU + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x243185beU + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x550c7dc3U + V[4] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x550c7dc3U + V[4] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x72be5d74U + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x72be5d74U + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x80deb1feU + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x80deb1feU + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x9bdc06a7U + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x9bdc06a7U + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0xc19bf3f4U + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0xc19bf3f4U + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += W16addK16 + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = W16addK16 + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += W17addK17 + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = W17addK17 + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + +//---------------------------------------------------------------------------------- + +#ifdef VECTORS4 + W[0] = PreW18 + (u)(rotr25(nonce.x), rotr25(nonce.x) ^ 0x2004000U, rotr25(nonce.x) ^ 0x4008000U, rotr25(nonce.x) ^ 0x600c000U); +#elif defined VECTORS2 + W[0] = PreW18 + (u)(rotr25(nonce.x), rotr25(nonce.x) ^ 0x2004000U); +#else + W[0] = PreW18 + rotr25(nonce); +#endif + W[1] = PreW19 + nonce; + W[2] = 0x80000000U + rotr15(W[0]); + W[3] = rotr15(W[1]); + W[4] = 0x00000280U + rotr15(W[2]); + W[5] = W16 + rotr15(W[3]); + W[6] = W17 + rotr15(W[4]); + W[7] = W[0] + rotr15(W[5]); + W[8] = W[1] + rotr15(W[6]); + W[9] = W[2] + rotr15(W[7]); + W[10] = W[3] + rotr15(W[8]); + W[11] = W[4] + rotr15(W[9]); + W[12] = W[5] + 0x00a00055U + rotr15(W[10]); + W[13] = W[6] + PreW31 + rotr15(W[11]); + W[14] = W[7] + PreW32 + rotr15(W[12]); + W[15] = W[8] + W17 + rotr15(W[13]) + rotr25(W[0]); + + V[1] += 0x0fc19dc6U + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + W[0]; + V[5] = 0x0fc19dc6U + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + W[0] + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x240ca1ccU + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x240ca1ccU + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x2de92c6fU + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x2de92c6fU + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x4a7484aaU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x4a7484aaU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x5cb0a9dcU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x5cb0a9dcU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x76f988daU + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x76f988daU + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x983e5152U + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x983e5152U + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xa831c66dU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xa831c66dU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0xb00327c8U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0xb00327c8U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0xbf597fc7U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0xbf597fc7U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0xc6e00bf3U + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0xc6e00bf3U + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xd5a79147U + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xd5a79147U + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x06ca6351U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x06ca6351U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x14292967U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x14292967U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x27b70a85U + V[7] + W[14] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x27b70a85U + V[7] + W[14] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x2e1b2138U + V[6] + W[15] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x2e1b2138U + V[6] + W[15] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + +//---------------------------------------------------------------------------------- + + W[0] = W[0] + W[9] + rotr15(W[14]) + rotr25( W[1]); + W[1] = W[1] + W[10] + rotr15(W[15]) + rotr25( W[2]); + W[2] = W[2] + W[11] + rotr15( W[0]) + rotr25( W[3]); + W[3] = W[3] + W[12] + rotr15( W[1]) + rotr25( W[4]); + W[4] = W[4] + W[13] + rotr15( W[2]) + rotr25( W[5]); + W[5] = W[5] + W[14] + rotr15( W[3]) + rotr25( W[6]); + W[6] = W[6] + W[15] + rotr15( W[4]) + rotr25( W[7]); + W[7] = W[7] + W[0] + rotr15( W[5]) + rotr25( W[8]); + W[8] = W[8] + W[1] + rotr15( W[6]) + rotr25( W[9]); + W[9] = W[9] + W[2] + rotr15( W[7]) + rotr25(W[10]); + W[10] = W[10] + W[3] + rotr15( W[8]) + rotr25(W[11]); + W[11] = W[11] + W[4] + rotr15( W[9]) + rotr25(W[12]); + W[12] = W[12] + W[5] + rotr15(W[10]) + rotr25(W[13]); + W[13] = W[13] + W[6] + rotr15(W[11]) + rotr25(W[14]); + W[14] = W[14] + W[7] + rotr15(W[12]) + rotr25(W[15]); + W[15] = W[15] + W[8] + rotr15(W[13]) + rotr25( W[0]); + + V[1] += 0x4d2c6dfcU + V[5] + W[0] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x4d2c6dfcU + V[5] + W[0] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x53380d13U + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x53380d13U + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x650a7354U + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x650a7354U + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x766a0abbU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x766a0abbU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x81c2c92eU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x81c2c92eU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x92722c85U + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x92722c85U + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0xa2bfe8a1U + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0xa2bfe8a1U + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xa81a664bU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xa81a664bU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0xc24b8b70U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0xc24b8b70U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0xc76c51a3U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0xc76c51a3U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0xd192e819U + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0xd192e819U + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xd6990624U + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xd6990624U + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0xf40e3585U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0xf40e3585U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x106aa070U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x106aa070U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x19a4c116U + V[7] + W[14] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x19a4c116U + V[7] + W[14] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x1e376c08U + V[6] + W[15] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x1e376c08U + V[6] + W[15] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + +//---------------------------------------------------------------------------------- + + W[0] = W[0] + W[9] + rotr15(W[14]) + rotr25( W[1]); + W[1] = W[1] + W[10] + rotr15(W[15]) + rotr25( W[2]); + W[2] = W[2] + W[11] + rotr15( W[0]) + rotr25( W[3]); + W[3] = W[3] + W[12] + rotr15( W[1]) + rotr25( W[4]); + W[4] = W[4] + W[13] + rotr15( W[2]) + rotr25( W[5]); + W[5] = W[5] + W[14] + rotr15( W[3]) + rotr25( W[6]); + W[6] = W[6] + W[15] + rotr15( W[4]) + rotr25( W[7]); + W[7] = W[7] + W[0] + rotr15( W[5]) + rotr25( W[8]); + W[8] = W[8] + W[1] + rotr15( W[6]) + rotr25( W[9]); + W[9] = W[9] + W[2] + rotr15( W[7]) + rotr25(W[10]); + W[10] = W[10] + W[3] + rotr15( W[8]) + rotr25(W[11]); + W[11] = W[11] + W[4] + rotr15( W[9]) + rotr25(W[12]); + W[12] = W[12] + W[5] + rotr15(W[10]) + rotr25(W[13]); + W[13] = W[13] + W[6] + rotr15(W[11]) + rotr25(W[14]); + + V[1] += 0x2748774cU + V[5] + W[0] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x2748774cU + V[5] + W[0] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x34b0bcb5U + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x34b0bcb5U + V[4] + W[1] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x391c0cb3U + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x391c0cb3U + V[3] + W[2] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x4ed8aa4aU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x4ed8aa4aU + V[2] + W[3] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x5b9cca4fU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x5b9cca4fU + V[1] + W[4] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x682e6ff3U + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x682e6ff3U + V[0] + W[5] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x748f82eeU + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x748f82eeU + V[7] + W[6] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x78a5636fU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x78a5636fU + V[6] + W[7] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x84c87814U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x84c87814U + V[5] + W[8] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x8cc70208U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x8cc70208U + V[4] + W[9] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x90befffaU + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x90befffaU + V[3] + W[10] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xa4506cebU + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xa4506cebU + V[2] + W[11] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0xbef9a3f7U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0xbef9a3f7U + V[1] + W[12] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0xc67178f2U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0xc67178f2U + V[0] + W[13] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + +//---------------------------------------------------------------------------------- + + W[0] = state0 + V[0] + rotr25(state1 + V[1]); + W[1] = state1 + V[1] + 0x00a00000U + rotr25(state2 + V[2]); + W[2] = state2 + V[2] + rotr15(W[0]) + rotr25(state3 + V[3]); + W[3] = state3 + V[3] + rotr15(W[1]) + rotr25(state4 + V[4]); + W[4] = state4 + V[4] + rotr15(W[2]) + rotr25(state5 + V[5]); + W[5] = state5 + V[5] + rotr15(W[3]) + rotr25(state6 + V[6]); + W[6] = state6 + V[6] + 0x00000100U + rotr15(W[4]) + rotr25(state7 + V[7]); + W[7] = state7 + V[7] + W[0] + 0x11002000U + rotr15(W[5]); + W[8] = W[1] + 0x80000000U + rotr15(W[6]); + W[9] = W[2] + rotr15(W[7]); + W[10] = W[3] + rotr15(W[8]); + W[11] = W[4] + rotr15(W[9]); + W[12] = W[5] + rotr15(W[10]); + W[13] = W[6] + rotr15(W[11]); + W[14] = W[7] + 0x00400022U + rotr15(W[12]); + W[15] = W[8] + 0x00000100U + rotr15(W[13]) + rotr25(W[0]); + + // 0x71374491U + 0x1f83d9abU + state1 + const u state1AaddV1 = state1A + V[1]; + // 0xb5c0fbcfU + 0x9b05688cU + state2 + const u state2AaddV2 = state2A + V[2]; + // 0x510e527fU + 0xe9b5dba5U + state3 + const u state3AaddV3 = state3A + V[3]; + // 0x3956c25bU + state4 + const u state4AaddV4 = state4A + V[4]; + // 0x59f111f1U + state5 + const u state5AaddV5 = state5A + V[5]; + // 0x923f82a4U + state6 + const u state6AaddV6 = state6A + V[6]; + // 0xab1c5ed5U + state7 + const u state7AaddV7 = state7A + V[7]; + + // 0x98c7e2a2U + state0 + V[3] = state0A + V[0]; + // 0xfc08884dU + state0 + V[7] = state0B + V[0]; + V[0] = 0x6a09e667U; + V[1] = 0xbb67ae85U; + V[2] = 0x3c6ef372U; + V[4] = 0x510e527fU; + V[5] = 0x9b05688cU; + V[6] = 0x1f83d9abU; + + V[2] += state1AaddV1 + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = state1AaddV1 + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += state2AaddV2 + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = state2AaddV2 + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += state3AaddV3 + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = state3AaddV3 + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += state4AaddV4 + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = state4AaddV4 + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += state5AaddV5 + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = state5AaddV5 + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += state6AaddV6 + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = state6AaddV6 + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += state7AaddV7 + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = state7AaddV7 + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x5807aa98U + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x5807aa98U + V[7] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x12835b01U + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x12835b01U + V[6] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x243185beU + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x243185beU + V[5] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x550c7dc3U + V[4] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x550c7dc3U + V[4] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x72be5d74U + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x72be5d74U + V[3] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x80deb1feU + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x80deb1feU + V[2] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x9bdc06a7U + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x9bdc06a7U + V[1] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0xc19bf274U + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0xc19bf274U + V[0] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0xe49b69c1U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0xe49b69c1U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xefbe4786U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xefbe4786U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x0fc19dc6U + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x0fc19dc6U + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x240ca1ccU + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x240ca1ccU + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x2de92c6fU + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x2de92c6fU + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x4a7484aaU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x4a7484aaU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x5cb0a9dcU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x5cb0a9dcU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x76f988daU + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x76f988daU + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x983e5152U + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x983e5152U + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xa831c66dU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xa831c66dU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0xb00327c8U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0xb00327c8U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0xbf597fc7U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0xbf597fc7U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0xc6e00bf3U + V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0xc6e00bf3U + V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xd5a79147U + V[2] + W[13] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xd5a79147U + V[2] + W[13] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x06ca6351U + V[1] + W[14] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x06ca6351U + V[1] + W[14] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x14292967U + V[0] + W[15] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x14292967U + V[0] + W[15] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + +//---------------------------------------------------------------------------------- + + W[0] = W[0] + W[9] + rotr15(W[14]) + rotr25( W[1]); + W[1] = W[1] + W[10] + rotr15(W[15]) + rotr25( W[2]); + W[2] = W[2] + W[11] + rotr15( W[0]) + rotr25( W[3]); + W[3] = W[3] + W[12] + rotr15( W[1]) + rotr25( W[4]); + W[4] = W[4] + W[13] + rotr15( W[2]) + rotr25( W[5]); + W[5] = W[5] + W[14] + rotr15( W[3]) + rotr25( W[6]); + W[6] = W[6] + W[15] + rotr15( W[4]) + rotr25( W[7]); + W[7] = W[7] + W[0] + rotr15( W[5]) + rotr25( W[8]); + W[8] = W[8] + W[1] + rotr15( W[6]) + rotr25( W[9]); + W[9] = W[9] + W[2] + rotr15( W[7]) + rotr25(W[10]); + W[10] = W[10] + W[3] + rotr15( W[8]) + rotr25(W[11]); + W[11] = W[11] + W[4] + rotr15( W[9]) + rotr25(W[12]); + W[12] = W[12] + W[5] + rotr15(W[10]) + rotr25(W[13]); + W[13] = W[13] + W[6] + rotr15(W[11]) + rotr25(W[14]); + W[14] = W[14] + W[7] + rotr15(W[12]) + rotr25(W[15]); + W[15] = W[15] + W[8] + rotr15(W[13]) + rotr25( W[0]); + + V[3] += 0x27b70a85U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x27b70a85U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x2e1b2138U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x2e1b2138U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x4d2c6dfcU + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x4d2c6dfcU + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x53380d13U + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x53380d13U + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x650a7354U + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x650a7354U + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x766a0abbU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x766a0abbU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x81c2c92eU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x81c2c92eU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x92722c85U + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x92722c85U + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0xa2bfe8a1U + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0xa2bfe8a1U + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0xa81a664bU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0xa81a664bU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0xc24b8b70U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0xc24b8b70U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0xc76c51a3U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0xc76c51a3U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0xd192e819U + V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0xd192e819U + V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0xd6990624U + V[2] + W[13] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0xd6990624U + V[2] + W[13] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0xf40e3585U + V[1] + W[14] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0xf40e3585U + V[1] + W[14] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x106aa070U + V[0] + W[15] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x106aa070U + V[0] + W[15] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + +//---------------------------------------------------------------------------------- + + W[0] = W[0] + W[9] + rotr15(W[14]) + rotr25( W[1]); + W[1] = W[1] + W[10] + rotr15(W[15]) + rotr25( W[2]); + W[2] = W[2] + W[11] + rotr15( W[0]) + rotr25( W[3]); + W[3] = W[3] + W[12] + rotr15( W[1]) + rotr25( W[4]); + W[4] = W[4] + W[13] + rotr15( W[2]) + rotr25( W[5]); + W[5] = W[5] + W[14] + rotr15( W[3]) + rotr25( W[6]); + W[6] = W[6] + W[15] + rotr15( W[4]) + rotr25( W[7]); + W[7] = W[7] + W[0] + rotr15( W[5]) + rotr25( W[8]); + W[8] = W[8] + W[1] + rotr15( W[6]) + rotr25( W[9]); + W[9] = W[9] + W[2] + rotr15( W[7]) + rotr25(W[10]); + W[10] = W[10] + W[3] + rotr15( W[8]) + rotr25(W[11]); + W[11] = W[11] + W[4] + rotr15( W[9]) + rotr25(W[12]); + W[12] = W[12] + W[5] + rotr15(W[10]) + rotr25(W[13]); + + V[3] += 0x19a4c116U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x19a4c116U + V[7] + W[0] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x1e376c08U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + V[6] = 0x1e376c08U + V[6] + W[1] + ch(V[3], V[4], V[5]) + rotr26(V[3]) + rotr30(V[7]) + ma(V[0], V[1], V[7]); + + V[1] += 0x2748774cU + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + V[5] = 0x2748774cU + V[5] + W[2] + ch(V[2], V[3], V[4]) + rotr26(V[2]) + rotr30(V[6]) + ma(V[7], V[0], V[6]); + + V[0] += 0x34b0bcb5U + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + V[4] = 0x34b0bcb5U + V[4] + W[3] + ch(V[1], V[2], V[3]) + rotr26(V[1]) + rotr30(V[5]) + ma(V[6], V[7], V[5]); + + V[7] += 0x391c0cb3U + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + V[3] = 0x391c0cb3U + V[3] + W[4] + ch(V[0], V[1], V[2]) + rotr26(V[0]) + rotr30(V[4]) + ma(V[5], V[6], V[4]); + + V[6] += 0x4ed8aa4aU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]); + V[2] = 0x4ed8aa4aU + V[2] + W[5] + ch(V[7], V[0], V[1]) + rotr26(V[7]) + rotr30(V[3]) + ma(V[4], V[5], V[3]); + + V[5] += 0x5b9cca4fU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]); + V[1] = 0x5b9cca4fU + V[1] + W[6] + ch(V[6], V[7], V[0]) + rotr26(V[6]) + rotr30(V[2]) + ma(V[3], V[4], V[2]); + + V[4] += 0x682e6ff3U + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]); + V[0] = 0x682e6ff3U + V[0] + W[7] + ch(V[5], V[6], V[7]) + rotr26(V[5]) + rotr30(V[1]) + ma(V[2], V[3], V[1]); + + V[3] += 0x748f82eeU + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]); + V[7] = 0x748f82eeU + V[7] + W[8] + ch(V[4], V[5], V[6]) + rotr26(V[4]) + rotr30(V[0]) + ma(V[1], V[2], V[0]); + + V[2] += 0x78a5636fU + V[6] + W[9] + ch(V[3], V[4], V[5]) + rotr26(V[3]); + + V[1] += 0x84c87814U + V[5] + W[10] + ch(V[2], V[3], V[4]) + rotr26(V[2]); + + V[0] += 0x8cc70208U + V[4] + W[11] + ch(V[1], V[2], V[3]) + rotr26(V[1]); + + V[7] += V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#ifdef VECTORS4 + if ((V[7].x == 0x136032edU) ^ (V[7].y == 0x136032edU) ^ (V[7].z == 0x136032edU) ^ (V[7].w == 0x136032edU)) { + if (V[7].x == 0x136032edU) + SETFOUND(nonce.x); + if (V[7].y == 0x136032edU) + SETFOUND(nonce.y); + if (V[7].z == 0x136032edU) + SETFOUND(nonce.z); + if (V[7].w == 0x136032edU) + SETFOUND(nonce.w); + } +#elif defined VECTORS2 + if ((V[7].x == 0x136032edU) + (V[7].y == 0x136032edU)) { + if (V[7].x == 0x136032edU) + SETFOUND(nonce.x); + if (V[7].y == 0x136032edU) + SETFOUND(nonce.y); + } +#else + if (V[7] == 0x136032edU) + SETFOUND(nonce); +#endif +} diff --git a/bfgminer3.9/share/bfgminer/opencl/phatk121016.cl b/bfgminer3.9/share/bfgminer/opencl/phatk121016.cl new file mode 100644 index 0000000..25024a0 --- /dev/null +++ b/bfgminer3.9/share/bfgminer/opencl/phatk121016.cl @@ -0,0 +1,417 @@ +// This file is taken and modified from the public-domain poclbm project, and +// I have therefore decided to keep it public-domain. +// Modified version copyright 2011-2012 Con Kolivas + +#ifdef VECTORS4 + typedef uint4 u; +#elif defined VECTORS2 + typedef uint2 u; +#else + typedef uint u; +#endif + +__constant uint K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +__constant uint ConstW[128] = { +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000U, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000280U, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x80000000U, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100U, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +__constant uint H[8] = { + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +}; + + +#ifdef BITALIGN + #pragma OPENCL EXTENSION cl_amd_media_ops : enable + #define rot(x, y) amd_bitalign(x, x, (uint)(32 - y)) + +// This part is not from the stock poclbm kernel. It's part of an optimization +// added in the Phoenix Miner. + +// Some AMD devices have Vals[0] BFI_INT opcode, which behaves exactly like the +// SHA-256 Ch function, but provides it in exactly one instruction. If +// detected, use it for Ch. Otherwise, construct Ch out of simpler logical +// primitives. + + #ifdef BFI_INT + // Well, slight problem... It turns out BFI_INT isn't actually exposed to + // OpenCL (or CAL IL for that matter) in any way. However, there is + // a similar instruction, BYTE_ALIGN_INT, which is exposed to OpenCL via + // amd_bytealign, takes the same inputs, and provides the same output. + // We can use that as a placeholder for BFI_INT and have the application + // patch it after compilation. + + // This is the BFI_INT function + #define Ch(x, y, z) amd_bytealign(x,y,z) + // Ma can also be implemented in terms of BFI_INT... + #define Ma(z, x, y) amd_bytealign(z^x,y,x) + #else // BFI_INT + // Later SDKs optimise this to BFI INT without patching and GCN + // actually fails if manually patched with BFI_INT + + #define Ch(x, y, z) bitselect((u)z, (u)y, (u)x) + #define Ma(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) + #define rotr(x, y) amd_bitalign((u)x, (u)x, (u)y) + #endif +#else // BITALIGN + #define Ch(x, y, z) (z ^ (x & (y ^ z))) + #define Ma(x, y, z) ((x & z) | (y & (x | z))) + #define rot(x, y) rotate(x, y) + #define rotr(x, y) rotate((u)x, (u)(32-y)) +#endif + + + +//Various intermediate calculations for each SHA round +#define s0(n) (S0(Vals[(0 + 128 - (n)) % 8])) +#define S0(n) (rot(n, 30u)^rot(n, 19u)^rot(n,10u)) + +#define s1(n) (S1(Vals[(4 + 128 - (n)) % 8])) +#define S1(n) (rot(n, 26u)^rot(n, 21u)^rot(n, 7u)) + +#define ch(n) Ch(Vals[(4 + 128 - (n)) % 8],Vals[(5 + 128 - (n)) % 8],Vals[(6 + 128 - (n)) % 8]) +#define maj(n) Ma(Vals[(1 + 128 - (n)) % 8],Vals[(2 + 128 - (n)) % 8],Vals[(0 + 128 - (n)) % 8]) + +//t1 calc when W is already calculated +#define t1(n) K[(n) % 64] + Vals[(7 + 128 - (n)) % 8] + W[(n)] + s1(n) + ch(n) + +//t1 calc which calculates W +#define t1W(n) K[(n) % 64] + Vals[(7 + 128 - (n)) % 8] + W(n) + s1(n) + ch(n) + +//Used for constant W Values (the compiler optimizes out zeros) +#define t1C(n) (K[(n) % 64]+ ConstW[(n)]) + Vals[(7 + 128 - (n)) % 8] + s1(n) + ch(n) + +//t2 Calc +#define t2(n) maj(n) + s0(n) + +#define rotC(x,n) (x<> (32-n)) + +//W calculation used for SHA round +#define W(n) (W[n] = P4(n) + P3(n) + P2(n) + P1(n)) + + + +//Partial W calculations (used for the begining where only some values are nonzero) +#define P1(n) ((rot(W[(n)-2],15u)^rot(W[(n)-2],13u)^((W[(n)-2])>>10U))) +#define P2(n) ((rot(W[(n)-15],25u)^rot(W[(n)-15],14u)^((W[(n)-15])>>3U))) + + +#define p1(x) ((rot(x,15u)^rot(x,13u)^((x)>>10U))) +#define p2(x) ((rot(x,25u)^rot(x,14u)^((x)>>3U))) + + +#define P3(n) W[n-7] +#define P4(n) W[n-16] + + +//Partial Calcs for constant W values +#define P1C(n) ((rotC(ConstW[(n)-2],15)^rotC(ConstW[(n)-2],13)^((ConstW[(n)-2])>>10U))) +#define P2C(n) ((rotC(ConstW[(n)-15],25)^rotC(ConstW[(n)-15],14)^((ConstW[(n)-15])>>3U))) +#define P3C(x) ConstW[x-7] +#define P4C(x) ConstW[x-16] + +//SHA round with built in W calc +#define sharoundW(n) Barrier1(n); Vals[(3 + 128 - (n)) % 8] += t1W(n); Vals[(7 + 128 - (n)) % 8] = t1W(n) + t2(n); + +//SHA round without W calc +#define sharound(n) Barrier2(n); Vals[(3 + 128 - (n)) % 8] += t1(n); Vals[(7 + 128 - (n)) % 8] = t1(n) + t2(n); + +//SHA round for constant W values +#define sharoundC(n) Barrier3(n); Vals[(3 + 128 - (n)) % 8] += t1C(n); Vals[(7 + 128 - (n)) % 8] = t1C(n) + t2(n); + +//The compiler is stupid... I put this in there only to stop the compiler from (de)optimizing the order +#define Barrier1(n) t1 = t1C((n+1)) +#define Barrier2(n) t1 = t1C((n)) +#define Barrier3(n) t1 = t1C((n)) + +//#define WORKSIZE 256 +#define MAXBUFFERS (4095) + +__kernel + __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) +void search( const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + const uint B1, const uint C1, const uint D1, + const uint F1, const uint G1, const uint H1, + const u base, + const uint W16, const uint W17, + const uint PreVal4, const uint PreVal0, + const uint PreW18, const uint PreW19, + const uint PreW31, const uint PreW32, + + volatile __global uint * output) +{ + + + u W[124]; + u Vals[8]; + +//Dummy Variable to prevent compiler from reordering between rounds + u t1; + + //Vals[0]=state0; + Vals[1]=B1; + Vals[2]=C1; + Vals[3]=D1; + //Vals[4]=PreVal4; + Vals[5]=F1; + Vals[6]=G1; + Vals[7]=H1; + + W[16] = W16; + W[17] = W17; + +#ifdef VECTORS4 + //Less dependencies to get both the local id and group id and then add them + W[3] = base + (uint)(get_local_id(0)) * 4u + (uint)(get_group_id(0)) * (WORKSIZE * 4u); + uint r = rot(W[3].x,25u)^rot(W[3].x,14u)^((W[3].x)>>3U); + //Since only the 2 LSB is opposite between the nonces, we can save an instruction by flipping the 4 bits in W18 rather than the 1 bit in W3 + W[18] = PreW18 + (u){r, r ^ 0x2004000U, r ^ 0x4008000U, r ^ 0x600C000U}; +#elif defined VECTORS2 + W[3] = base + (uint)(get_local_id(0)) * 2u + (uint)(get_group_id(0)) * (WORKSIZE * 2u); + uint r = rot(W[3].x,25u)^rot(W[3].x,14u)^((W[3].x)>>3U); + W[18] = PreW18 + (u){r, r ^ 0x2004000U}; +#else + W[3] = base + get_local_id(0) + get_group_id(0) * (WORKSIZE); + u r = rot(W[3],25u)^rot(W[3],14u)^((W[3])>>3U); + W[18] = PreW18 + r; +#endif + //the order of the W calcs and Rounds is like this because the compiler needs help finding how to order the instructions + + + + Vals[4] = PreVal4 + W[3]; + Vals[0] = PreVal0 + W[3]; + + sharoundC(4); + W[19] = PreW19 + W[3]; + sharoundC(5); + W[20] = P4C(20) + P1(20); + sharoundC(6); + W[21] = P1(21); + sharoundC(7); + W[22] = P3C(22) + P1(22); + sharoundC(8); + W[23] = W[16] + P1(23); + sharoundC(9); + W[24] = W[17] + P1(24); + sharoundC(10); + W[25] = P1(25) + P3(25); + W[26] = P1(26) + P3(26); + sharoundC(11); + W[27] = P1(27) + P3(27); + W[28] = P1(28) + P3(28); + sharoundC(12); + W[29] = P1(29) + P3(29); + sharoundC(13); + W[30] = P1(30) + P2C(30) + P3(30); + W[31] = PreW31 + (P1(31) + P3(31)); + sharoundC(14); + W[32] = PreW32 + (P1(32) + P3(32)); + sharoundC(15); + sharound(16); + sharound(17); + sharound(18); + sharound(19); + sharound(20); + sharound(21); + sharound(22); + sharound(23); + sharound(24); + sharound(25); + sharound(26); + sharound(27); + sharound(28); + sharound(29); + sharound(30); + sharound(31); + sharound(32); + sharoundW(33); + sharoundW(34); + sharoundW(35); + sharoundW(36); + sharoundW(37); + sharoundW(38); + sharoundW(39); + sharoundW(40); + sharoundW(41); + sharoundW(42); + sharoundW(43); + sharoundW(44); + sharoundW(45); + sharoundW(46); + sharoundW(47); + sharoundW(48); + sharoundW(49); + sharoundW(50); + sharoundW(51); + sharoundW(52); + sharoundW(53); + sharoundW(54); + sharoundW(55); + sharoundW(56); + sharoundW(57); + sharoundW(58); + sharoundW(59); + sharoundW(60); + sharoundW(61); + sharoundW(62); + sharoundW(63); + + W[64]=state0+Vals[0]; + W[65]=state1+Vals[1]; + W[66]=state2+Vals[2]; + W[67]=state3+Vals[3]; + W[68]=state4+Vals[4]; + W[69]=state5+Vals[5]; + W[70]=state6+Vals[6]; + W[71]=state7+Vals[7]; + + Vals[0]=H[0]; + Vals[1]=H[1]; + Vals[2]=H[2]; + Vals[3]=H[3]; + Vals[4]=H[4]; + Vals[5]=H[5]; + Vals[6]=H[6]; + Vals[7]=H[7]; + + //sharound(64 + 0); + const u Temp = (0xb0edbdd0U + K[0]) + W[64]; + Vals[7] = Temp + 0x08909ae5U; + Vals[3] = 0xa54ff53aU + Temp; + +#define P124(n) P2(n) + P1(n) + P4(n) + + + W[64 + 16] = + P2(64 + 16) + P4(64 + 16); + sharound(64 + 1); + W[64 + 17] = P1C(64 + 17) + P2(64 + 17) + P4(64 + 17); + sharound(64 + 2); + W[64 + 18] = P124(64 + 18); + sharound(64 + 3); + W[64 + 19] = P124(64 + 19); + sharound(64 + 4); + W[64 + 20] = P124(64 + 20); + sharound(64 + 5); + W[64 + 21] = P124(64 + 21); + sharound(64 + 6); + W[64 + 22] = P4(64 + 22) + P3C(64 + 22) + P2(64 + 22) + P1(64 + 22); + sharound(64 + 7); + W[64 + 23] = P4(64 + 23) + P3(64 + 23) + P2C(64 + 23) + P1(64 + 23); + sharoundC(64 + 8); + W[64 + 24] = P1(64 + 24) + P4C(64 + 24) + P3(64 + 24); + sharoundC(64 + 9); + W[64 + 25] = P3(64 + 25) + P1(64 + 25); + sharoundC(64 + 10); + W[64 + 26] = P3(64 + 26) + P1(64 + 26); + sharoundC(64 + 11); + W[64 + 27] = P3(64 + 27) + P1(64 + 27); + sharoundC(64 + 12); + W[64 + 28] = P3(64 + 28) + P1(64 + 28); + sharoundC(64 + 13); + W[64 + 29] = P1(64 + 29) + P3(64 + 29); + W[64 + 30] = P3(64 + 30) + P2C(64 + 30) + P1(64 + 30); + sharoundC(64 + 14); + W[64 + 31] = P4C(64 + 31) + P3(64 + 31) + P2(64 + 31) + P1(64 + 31); + sharoundC(64 + 15); + sharound(64 + 16); + sharound(64 + 17); + sharound(64 + 18); + sharound(64 + 19); + sharound(64 + 20); + sharound(64 + 21); + sharound(64 + 22); + sharound(64 + 23); + sharound(64 + 24); + sharound(64 + 25); + sharound(64 + 26); + sharound(64 + 27); + sharound(64 + 28); + sharound(64 + 29); + sharound(64 + 30); + sharound(64 + 31); + sharoundW(64 + 32); + sharoundW(64 + 33); + sharoundW(64 + 34); + sharoundW(64 + 35); + sharoundW(64 + 36); + sharoundW(64 + 37); + sharoundW(64 + 38); + sharoundW(64 + 39); + sharoundW(64 + 40); + sharoundW(64 + 41); + sharoundW(64 + 42); + sharoundW(64 + 43); + sharoundW(64 + 44); + sharoundW(64 + 45); + sharoundW(64 + 46); + sharoundW(64 + 47); + sharoundW(64 + 48); + sharoundW(64 + 49); + sharoundW(64 + 50); + sharoundW(64 + 51); + sharoundW(64 + 52); + sharoundW(64 + 53); + sharoundW(64 + 54); + sharoundW(64 + 55); + sharoundW(64 + 56); + sharoundW(64 + 57); + sharoundW(64 + 58); + + W[117] += W[108] + Vals[3] + Vals[7] + P2(124) + P1(124) + Ch((Vals[0] + Vals[4]) + (K[59] + W(59+64)) + s1(64+59)+ ch(59+64),Vals[1],Vals[2]) - + (-(K[60] + H[7]) - S1((Vals[0] + Vals[4]) + (K[59] + W(59+64)) + s1(64+59)+ ch(59+64))); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#ifdef VECTORS4 + bool result = W[117].x & W[117].y & W[117].z & W[117].w; + if (!result) { + if (!W[117].x) + SETFOUND(W[3].x); + if (!W[117].y) + SETFOUND(W[3].y); + if (!W[117].z) + SETFOUND(W[3].z); + if (!W[117].w) + SETFOUND(W[3].w); + } +#elif defined VECTORS2 + bool result = W[117].x & W[117].y; + if (!result) { + if (!W[117].x) + SETFOUND(W[3].x); + if (!W[117].y) + SETFOUND(W[3].y); + } +#else + if (!W[117]) + SETFOUND(W[3]); +#endif +} diff --git a/bfgminer3.9/share/bfgminer/opencl/poclbm130302.cl b/bfgminer3.9/share/bfgminer/opencl/poclbm130302.cl new file mode 100644 index 0000000..6f5fd01 --- /dev/null +++ b/bfgminer3.9/share/bfgminer/opencl/poclbm130302.cl @@ -0,0 +1,1388 @@ +// -ck modified kernel taken from Phoenix taken from poclbm, with aspects of +// phatk and others. +// Modified version copyright 2011-2012 Con Kolivas + +// This file is taken and modified from the public-domain poclbm project, and +// we have therefore decided to keep it public-domain in Phoenix. + +#ifdef VECTORS4 + typedef uint4 u; +#elif defined VECTORS2 + typedef uint2 u; +#else + typedef uint u; +#endif + +__constant uint K[87] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, + + 0xc19bf3f4U, + 0x80000000U, + 0x00000280U, + 0x00a00055U, + 0xf377ed68U, + 0xa54ff53aU, + 0x08909ae5U, + 0x90bb1e3cU, + 0x9b05688cU, + 0xca0b3af3U, + 0x3c6ef372U, + 0xbb67ae85U, + 0x6a09e667U, + 0x50c6645bU, + 0x510e527fU, + 0x3ac42e24U, + 0x5807aa98U, + 0xc19bf274U, + 0x00a00000U, + 0x00000100U, + 0x11002000U, + 0x00400022U, + 0x136032edU +}; + +#define xc19bf3f4U K[64] +#define x80000000U K[65] +#define x00000280U K[66] +#define x00a00055U K[67] +#define xf377ed68U K[68] +#define xa54ff53aU K[69] +#define x08909ae5U K[70] +#define x90bb1e3cU K[71] +#define x9b05688cU K[72] +#define xca0b3af3U K[73] +#define x3c6ef372U K[74] +#define xbb67ae85U K[75] +#define x6a09e667U K[76] +#define x50c6645bU K[77] +#define x510e527fU K[78] +#define x3ac42e24U K[79] +#define x5807aa98U K[80] +#define xc19bf274U K[81] +#define x00a00000U K[82] +#define x00000100U K[83] +#define x11002000U K[84] +#define x00400022U K[85] +#define x136032edU K[86] + +// This part is not from the stock poclbm kernel. It's part of an optimization +// added in the Phoenix Miner. + +// Some AMD devices have a BFI_INT opcode, which behaves exactly like the +// SHA-256 ch function, but provides it in exactly one instruction. If +// detected, use it for ch. Otherwise, construct ch out of simpler logical +// primitives. + +#ifdef BITALIGN + #pragma OPENCL EXTENSION cl_amd_media_ops : enable + #define rotr(x, y) amd_bitalign((u)x, (u)x, (u)y) +#else + #define rotr(x, y) rotate((u)x, (u)(32 - y)) +#endif +#ifdef BFI_INT + // Well, slight problem... It turns out BFI_INT isn't actually exposed to + // OpenCL (or CAL IL for that matter) in any way. However, there is + // a similar instruction, BYTE_ALIGN_INT, which is exposed to OpenCL via + // amd_bytealign, takes the same inputs, and provides the same output. + // We can use that as a placeholder for BFI_INT and have the application + // patch it after compilation. + + // This is the BFI_INT function + #define ch(x, y, z) amd_bytealign(x, y, z) + + // Ma can also be implemented in terms of BFI_INT... + #define Ma(x, y, z) amd_bytealign( (z^x), (y), (x) ) + + // AMD's KernelAnalyzer throws errors compiling the kernel if we use + // amd_bytealign on constants with vectors enabled, so we use this to avoid + // problems. (this is used 4 times, and likely optimized out by the compiler.) + #define Ma2(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) +#else // BFI_INT + //GCN actually fails if manually patched with BFI_INT + + #define ch(x, y, z) bitselect((u)z, (u)y, (u)x) + #define Ma(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) + #define Ma2(x, y, z) Ma(x, y, z) +#endif + + +__kernel +__attribute__((vec_type_hint(u))) +__attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) +void search(const uint state0, const uint state1, const uint state2, const uint state3, + const uint state4, const uint state5, const uint state6, const uint state7, + const uint b1, const uint c1, + const uint f1, const uint g1, const uint h1, +#ifndef GOFFSET + const u base, +#endif + const uint fw0, const uint fw1, const uint fw2, const uint fw3, const uint fw15, const uint fw01r, + const uint D1A, const uint C1addK5, const uint B1addK6, + const uint W16addK16, const uint W17addK17, + const uint PreVal4addT1, const uint Preval0, + volatile __global uint * output) +{ + u Vals[24]; + u *W = &Vals[8]; + +#ifdef GOFFSET + const u nonce = (uint)(get_global_id(0)); +#else + const u nonce = base + (uint)(get_global_id(0)); +#endif + +Vals[5]=Preval0; +Vals[5]+=nonce; + +Vals[0]=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],b1,c1); +Vals[0]+=D1A; + +Vals[2]=Vals[0]; +Vals[2]+=h1; + +Vals[1]=PreVal4addT1; +Vals[1]+=nonce; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); + +Vals[6]=C1addK5; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],b1); + +Vals[3]=Vals[6]; +Vals[3]+=g1; +Vals[0]+=Ma2(g1,Vals[1],f1); +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma2(f1,Vals[0],Vals[1]); + +Vals[7]=B1addK6; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); + +Vals[4]=Vals[7]; +Vals[4]+=f1; + +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[7]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[8]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[9]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[10]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[11]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[12]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[13]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[14]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=xc19bf3f4U; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=W16addK16; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=W17addK17; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]=(rotr(nonce,7)^rotr(nonce,18)^(nonce>>3U)); +W[2]+=fw2; +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[18]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]=nonce; +W[3]+=fw3; +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[19]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +W[4]+=x80000000U; +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[20]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[21]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +W[6]+=x00000280U; +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[22]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +W[7]+=fw0; +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[23]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +W[8]+=fw1; +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[24]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[25]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[26]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[27]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[28]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[29]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]=x00a00055U; +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[30]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]=fw15; +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[31]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]=fw01r; +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[32]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]=fw1; +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[33]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[34]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[35]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[36]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[37]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[38]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[39]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[40]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[41]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[42]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[43]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[44]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[45]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[46]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[47]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[48]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[49]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[50]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[51]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[52]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[53]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[54]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[55]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[56]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[57]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[58]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[59]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[60]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[61]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=W[14]; +Vals[7]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +Vals[7]+=W[7]; +Vals[7]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[62]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=W[15]; +Vals[5]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +Vals[5]+=W[8]; +Vals[5]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[63]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[5]+=state0; + +W[7]=state7; +W[7]+=Vals[2]; + +Vals[2]=xf377ed68U; +Vals[2]+=Vals[5]; +W[0]=Vals[5]; +Vals[5]=x6a09e667U; + +W[3]=state3; +W[3]+=Vals[0]; + +Vals[0]=xa54ff53aU; +Vals[0]+=Vals[2]; +Vals[2]+=x08909ae5U; + +W[6]=state6; +W[6]+=Vals[3]; + +Vals[3]=x90bb1e3cU; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=(x9b05688cU^(Vals[0]&xca0b3af3U)); + +Vals[7]+=state1; +Vals[3]+=Vals[7]; +W[1]=Vals[7]; +Vals[7]=xbb67ae85U; + +W[2]=state2; +W[2]+=Vals[6]; + +Vals[6]=x3c6ef372U; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma2(Vals[7],Vals[2],Vals[5]); + +W[5]=state5; +W[5]+=Vals[4]; + +Vals[4]=x50c6645bU; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],x510e527fU); +Vals[4]+=W[2]; + +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma2(Vals[5],Vals[3],Vals[2]); + +W[4]=state4; +W[4]+=Vals[1]; + +Vals[1]=x3ac42e24U; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=W[3]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[4]; +Vals[0]+=W[4]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[5]; +Vals[6]+=W[5]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[6]; +Vals[7]+=W[6]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[7]; +Vals[5]+=W[7]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=x5807aa98U; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[9]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[10]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[11]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[12]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[13]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[14]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=xc19bf274U; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[16]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=x00a00000U; +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[17]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[18]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[19]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[20]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[21]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=x00000100U; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[22]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=x11002000U; +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[23]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]=x80000000U; +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[24]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[25]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[26]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[27]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[28]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[29]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]=x00400022U; +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[30]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]=x00000100U; +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[31]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[32]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[33]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[34]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[35]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[36]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[37]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[38]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[39]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[40]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[41]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[42]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[11]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +W[11]+=W[4]; +W[11]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=W[11]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[43]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[12]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +W[12]+=W[5]; +W[12]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[0]+=W[12]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[44]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[13]+=(rotr(W[14],7)^rotr(W[14],18)^(W[14]>>3U)); +W[13]+=W[6]; +W[13]+=(rotr(W[11],17)^rotr(W[11],19)^(W[11]>>10U)); +Vals[6]+=W[13]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[45]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[14]+=(rotr(W[15],7)^rotr(W[15],18)^(W[15]>>3U)); +W[14]+=W[7]; +W[14]+=(rotr(W[12],17)^rotr(W[12],19)^(W[12]>>10U)); +Vals[7]+=W[14]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[46]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[15]+=(rotr(W[0],7)^rotr(W[0],18)^(W[0]>>3U)); +W[15]+=W[8]; +W[15]+=(rotr(W[13],17)^rotr(W[13],19)^(W[13]>>10U)); +Vals[5]+=W[15]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[47]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[0]+=(rotr(W[1],7)^rotr(W[1],18)^(W[1]>>3U)); +W[0]+=W[9]; +W[0]+=(rotr(W[14],17)^rotr(W[14],19)^(W[14]>>10U)); +Vals[2]+=W[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[48]; +Vals[0]+=Vals[2]; +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); + +W[1]+=(rotr(W[2],7)^rotr(W[2],18)^(W[2]>>3U)); +W[1]+=W[10]; +W[1]+=(rotr(W[15],17)^rotr(W[15],19)^(W[15]>>10U)); +Vals[3]+=W[1]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[49]; +Vals[6]+=Vals[3]; +Vals[3]+=(rotr(Vals[2],2)^rotr(Vals[2],13)^rotr(Vals[2],22)); +Vals[3]+=Ma(Vals[7],Vals[2],Vals[5]); + +W[2]+=(rotr(W[3],7)^rotr(W[3],18)^(W[3]>>3U)); +W[2]+=W[11]; +W[2]+=(rotr(W[0],17)^rotr(W[0],19)^(W[0]>>10U)); +Vals[4]+=W[2]; +Vals[4]+=(rotr(Vals[6],6)^rotr(Vals[6],11)^rotr(Vals[6],25)); +Vals[4]+=ch(Vals[6],Vals[0],Vals[1]); +Vals[4]+=K[50]; +Vals[7]+=Vals[4]; +Vals[4]+=(rotr(Vals[3],2)^rotr(Vals[3],13)^rotr(Vals[3],22)); +Vals[4]+=Ma(Vals[5],Vals[3],Vals[2]); + +W[3]+=(rotr(W[4],7)^rotr(W[4],18)^(W[4]>>3U)); +W[3]+=W[12]; +W[3]+=(rotr(W[1],17)^rotr(W[1],19)^(W[1]>>10U)); +Vals[1]+=W[3]; +Vals[1]+=(rotr(Vals[7],6)^rotr(Vals[7],11)^rotr(Vals[7],25)); +Vals[1]+=ch(Vals[7],Vals[6],Vals[0]); +Vals[1]+=K[51]; +Vals[5]+=Vals[1]; +Vals[1]+=(rotr(Vals[4],2)^rotr(Vals[4],13)^rotr(Vals[4],22)); +Vals[1]+=Ma(Vals[2],Vals[4],Vals[3]); + +W[4]+=(rotr(W[5],7)^rotr(W[5],18)^(W[5]>>3U)); +W[4]+=W[13]; +W[4]+=(rotr(W[2],17)^rotr(W[2],19)^(W[2]>>10U)); +Vals[0]+=W[4]; +Vals[0]+=(rotr(Vals[5],6)^rotr(Vals[5],11)^rotr(Vals[5],25)); +Vals[0]+=ch(Vals[5],Vals[7],Vals[6]); +Vals[0]+=K[52]; +Vals[2]+=Vals[0]; +Vals[0]+=(rotr(Vals[1],2)^rotr(Vals[1],13)^rotr(Vals[1],22)); +Vals[0]+=Ma(Vals[3],Vals[1],Vals[4]); + +W[5]+=(rotr(W[6],7)^rotr(W[6],18)^(W[6]>>3U)); +W[5]+=W[14]; +W[5]+=(rotr(W[3],17)^rotr(W[3],19)^(W[3]>>10U)); +Vals[6]+=W[5]; +Vals[6]+=(rotr(Vals[2],6)^rotr(Vals[2],11)^rotr(Vals[2],25)); +Vals[6]+=ch(Vals[2],Vals[5],Vals[7]); +Vals[6]+=K[53]; +Vals[3]+=Vals[6]; +Vals[6]+=(rotr(Vals[0],2)^rotr(Vals[0],13)^rotr(Vals[0],22)); +Vals[6]+=Ma(Vals[4],Vals[0],Vals[1]); + +W[6]+=(rotr(W[7],7)^rotr(W[7],18)^(W[7]>>3U)); +W[6]+=W[15]; +W[6]+=(rotr(W[4],17)^rotr(W[4],19)^(W[4]>>10U)); +Vals[7]+=W[6]; +Vals[7]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[7]+=ch(Vals[3],Vals[2],Vals[5]); +Vals[7]+=K[54]; +Vals[4]+=Vals[7]; +Vals[7]+=(rotr(Vals[6],2)^rotr(Vals[6],13)^rotr(Vals[6],22)); +Vals[7]+=Ma(Vals[1],Vals[6],Vals[0]); + +W[7]+=(rotr(W[8],7)^rotr(W[8],18)^(W[8]>>3U)); +W[7]+=W[0]; +W[7]+=(rotr(W[5],17)^rotr(W[5],19)^(W[5]>>10U)); +Vals[5]+=W[7]; +Vals[5]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[5]+=ch(Vals[4],Vals[3],Vals[2]); +Vals[5]+=K[55]; +Vals[1]+=Vals[5]; +Vals[5]+=(rotr(Vals[7],2)^rotr(Vals[7],13)^rotr(Vals[7],22)); +Vals[5]+=Ma(Vals[0],Vals[7],Vals[6]); + +W[8]+=(rotr(W[9],7)^rotr(W[9],18)^(W[9]>>3U)); +W[8]+=W[1]; +W[8]+=(rotr(W[6],17)^rotr(W[6],19)^(W[6]>>10U)); +Vals[2]+=W[8]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); +Vals[2]+=K[56]; +Vals[0]+=Vals[2]; + +W[9]+=(rotr(W[10],7)^rotr(W[10],18)^(W[10]>>3U)); +W[9]+=W[2]; +W[9]+=(rotr(W[7],17)^rotr(W[7],19)^(W[7]>>10U)); +Vals[3]+=W[9]; +Vals[3]+=(rotr(Vals[0],6)^rotr(Vals[0],11)^rotr(Vals[0],25)); +Vals[3]+=ch(Vals[0],Vals[1],Vals[4]); +Vals[3]+=K[57]; +Vals[3]+=Vals[6]; + +W[10]+=(rotr(W[11],7)^rotr(W[11],18)^(W[11]>>3U)); +W[10]+=W[3]; +W[10]+=(rotr(W[8],17)^rotr(W[8],19)^(W[8]>>10U)); +Vals[4]+=W[10]; +Vals[4]+=(rotr(Vals[3],6)^rotr(Vals[3],11)^rotr(Vals[3],25)); +Vals[4]+=ch(Vals[3],Vals[0],Vals[1]); +Vals[4]+=K[58]; +Vals[4]+=Vals[7]; +Vals[1]+=(rotr(Vals[4],6)^rotr(Vals[4],11)^rotr(Vals[4],25)); +Vals[1]+=ch(Vals[4],Vals[3],Vals[0]); +Vals[1]+=W[11]; +Vals[1]+=(rotr(W[12],7)^rotr(W[12],18)^(W[12]>>3U)); +Vals[1]+=W[4]; +Vals[1]+=(rotr(W[9],17)^rotr(W[9],19)^(W[9]>>10U)); +Vals[1]+=K[59]; +Vals[1]+=Vals[5]; + +Vals[2]+=Ma(Vals[6],Vals[5],Vals[7]); +Vals[2]+=(rotr(Vals[5],2)^rotr(Vals[5],13)^rotr(Vals[5],22)); +Vals[2]+=W[12]; +Vals[2]+=(rotr(W[13],7)^rotr(W[13],18)^(W[13]>>3U)); +Vals[2]+=W[5]; +Vals[2]+=(rotr(W[10],17)^rotr(W[10],19)^(W[10]>>10U)); +Vals[2]+=Vals[0]; +Vals[2]+=(rotr(Vals[1],6)^rotr(Vals[1],11)^rotr(Vals[1],25)); +Vals[2]+=ch(Vals[1],Vals[4],Vals[3]); + +#define FOUND (0x0F) +#define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce + +#if defined(VECTORS2) || defined(VECTORS4) + if (any(Vals[2] == x136032edU)) { + if (Vals[2].x == x136032edU) + SETFOUND(nonce.x); + if (Vals[2].y == x136032edU) + SETFOUND(nonce.y); +#if defined(VECTORS4) + if (Vals[2].z == x136032edU) + SETFOUND(nonce.z); + if (Vals[2].w == x136032edU) + SETFOUND(nonce.w); +#endif + } +#else + if (Vals[2] == x136032edU) + SETFOUND(nonce); +#endif +} diff --git a/bfgminer3.9/share/bfgminer/opencl/scrypt130511.cl b/bfgminer3.9/share/bfgminer/opencl/scrypt130511.cl new file mode 100644 index 0000000..5ae0304 --- /dev/null +++ b/bfgminer3.9/share/bfgminer/opencl/scrypt130511.cl @@ -0,0 +1,853 @@ +/*- + * Copyright 2009 Colin Percival, 2011 ArtForz, 2011 pooler, 2012 mtrlt, + * 2012-2013 Con Kolivas. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ + +__constant uint ES[2] = { 0x00FF00FF, 0xFF00FF00 }; +__constant uint K[] = { + 0x428a2f98U, + 0x71374491U, + 0xb5c0fbcfU, + 0xe9b5dba5U, + 0x3956c25bU, + 0x59f111f1U, + 0x923f82a4U, + 0xab1c5ed5U, + 0xd807aa98U, + 0x12835b01U, + 0x243185beU, // 10 + 0x550c7dc3U, + 0x72be5d74U, + 0x80deb1feU, + 0x9bdc06a7U, + 0xe49b69c1U, + 0xefbe4786U, + 0x0fc19dc6U, + 0x240ca1ccU, + 0x2de92c6fU, + 0x4a7484aaU, // 20 + 0x5cb0a9dcU, + 0x76f988daU, + 0x983e5152U, + 0xa831c66dU, + 0xb00327c8U, + 0xbf597fc7U, + 0xc6e00bf3U, + 0xd5a79147U, + 0x06ca6351U, + 0x14292967U, // 30 + 0x27b70a85U, + 0x2e1b2138U, + 0x4d2c6dfcU, + 0x53380d13U, + 0x650a7354U, + 0x766a0abbU, + 0x81c2c92eU, + 0x92722c85U, + 0xa2bfe8a1U, + 0xa81a664bU, // 40 + 0xc24b8b70U, + 0xc76c51a3U, + 0xd192e819U, + 0xd6990624U, + 0xf40e3585U, + 0x106aa070U, + 0x19a4c116U, + 0x1e376c08U, + 0x2748774cU, + 0x34b0bcb5U, // 50 + 0x391c0cb3U, + 0x4ed8aa4aU, + 0x5b9cca4fU, + 0x682e6ff3U, + 0x748f82eeU, + 0x78a5636fU, + 0x84c87814U, + 0x8cc70208U, + 0x90befffaU, + 0xa4506cebU, // 60 + 0xbef9a3f7U, + 0xc67178f2U, + 0x98c7e2a2U, + 0xfc08884dU, + 0xcd2a11aeU, + 0x510e527fU, + 0x9b05688cU, + 0xC3910C8EU, + 0xfb6feee7U, + 0x2a01a605U, // 70 + 0x0c2e12e0U, + 0x4498517BU, + 0x6a09e667U, + 0xa4ce148bU, + 0x95F61999U, + 0xc19bf174U, + 0xBB67AE85U, + 0x3C6EF372U, + 0xA54FF53AU, + 0x1F83D9ABU, // 80 + 0x5BE0CD19U, + 0x5C5C5C5CU, + 0x36363636U, + 0x80000000U, + 0x000003FFU, + 0x00000280U, + 0x000004a0U, + 0x00000300U +}; + +#define rotl(x,y) rotate(x,y) +#define Ch(x,y,z) bitselect(z,y,x) +#define Maj(x,y,z) Ch((x^z),y,z) + +#define EndianSwap(n) (rotl(n & ES[0], 24U)|rotl(n & ES[1], 8U)) + +#define Tr2(x) (rotl(x, 30U) ^ rotl(x, 19U) ^ rotl(x, 10U)) +#define Tr1(x) (rotl(x, 26U) ^ rotl(x, 21U) ^ rotl(x, 7U)) +#define Wr2(x) (rotl(x, 25U) ^ rotl(x, 14U) ^ (x>>3U)) +#define Wr1(x) (rotl(x, 15U) ^ rotl(x, 13U) ^ (x>>10U)) + +#define RND(a, b, c, d, e, f, g, h, k) \ + h += Tr1(e); \ + h += Ch(e, f, g); \ + h += k; \ + d += h; \ + h += Tr2(a); \ + h += Maj(a, b, c); + +void SHA256(uint4*restrict state0,uint4*restrict state1, const uint4 block0, const uint4 block1, const uint4 block2, const uint4 block3) +{ + uint4 S0 = *state0; + uint4 S1 = *state1; + +#define A S0.x +#define B S0.y +#define C S0.z +#define D S0.w +#define E S1.x +#define F S1.y +#define G S1.z +#define H S1.w + + uint4 W[4]; + + W[ 0].x = block0.x; + RND(A,B,C,D,E,F,G,H, W[0].x+ K[0]); + W[ 0].y = block0.y; + RND(H,A,B,C,D,E,F,G, W[0].y+ K[1]); + W[ 0].z = block0.z; + RND(G,H,A,B,C,D,E,F, W[0].z+ K[2]); + W[ 0].w = block0.w; + RND(F,G,H,A,B,C,D,E, W[0].w+ K[3]); + + W[ 1].x = block1.x; + RND(E,F,G,H,A,B,C,D, W[1].x+ K[4]); + W[ 1].y = block1.y; + RND(D,E,F,G,H,A,B,C, W[1].y+ K[5]); + W[ 1].z = block1.z; + RND(C,D,E,F,G,H,A,B, W[1].z+ K[6]); + W[ 1].w = block1.w; + RND(B,C,D,E,F,G,H,A, W[1].w+ K[7]); + + W[ 2].x = block2.x; + RND(A,B,C,D,E,F,G,H, W[2].x+ K[8]); + W[ 2].y = block2.y; + RND(H,A,B,C,D,E,F,G, W[2].y+ K[9]); + W[ 2].z = block2.z; + RND(G,H,A,B,C,D,E,F, W[2].z+ K[10]); + W[ 2].w = block2.w; + RND(F,G,H,A,B,C,D,E, W[2].w+ K[11]); + + W[ 3].x = block3.x; + RND(E,F,G,H,A,B,C,D, W[3].x+ K[12]); + W[ 3].y = block3.y; + RND(D,E,F,G,H,A,B,C, W[3].y+ K[13]); + W[ 3].z = block3.z; + RND(C,D,E,F,G,H,A,B, W[3].z+ K[14]); + W[ 3].w = block3.w; + RND(B,C,D,E,F,G,H,A, W[3].w+ K[76]); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[15]); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[16]); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[17]); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[18]); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[19]); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[20]); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[21]); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[22]); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[23]); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[24]); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[25]); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[26]); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[27]); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[28]); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[29]); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[30]); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[31]); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[32]); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[33]); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[34]); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[35]); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[36]); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[37]); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[38]); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[39]); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[40]); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[41]); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[42]); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[43]); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[44]); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[45]); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[46]); + + W[ 0].x += Wr1(W[ 3].z) + W[ 2].y + Wr2(W[ 0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[47]); + + W[ 0].y += Wr1(W[ 3].w) + W[ 2].z + Wr2(W[ 0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[48]); + + W[ 0].z += Wr1(W[ 0].x) + W[ 2].w + Wr2(W[ 0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[49]); + + W[ 0].w += Wr1(W[ 0].y) + W[ 3].x + Wr2(W[ 1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[50]); + + W[ 1].x += Wr1(W[ 0].z) + W[ 3].y + Wr2(W[ 1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[51]); + + W[ 1].y += Wr1(W[ 0].w) + W[ 3].z + Wr2(W[ 1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[52]); + + W[ 1].z += Wr1(W[ 1].x) + W[ 3].w + Wr2(W[ 1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[53]); + + W[ 1].w += Wr1(W[ 1].y) + W[ 0].x + Wr2(W[ 2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[54]); + + W[ 2].x += Wr1(W[ 1].z) + W[ 0].y + Wr2(W[ 2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[55]); + + W[ 2].y += Wr1(W[ 1].w) + W[ 0].z + Wr2(W[ 2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[56]); + + W[ 2].z += Wr1(W[ 2].x) + W[ 0].w + Wr2(W[ 2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[57]); + + W[ 2].w += Wr1(W[ 2].y) + W[ 1].x + Wr2(W[ 3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[58]); + + W[ 3].x += Wr1(W[ 2].z) + W[ 1].y + Wr2(W[ 3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[59]); + + W[ 3].y += Wr1(W[ 2].w) + W[ 1].z + Wr2(W[ 3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[60]); + + W[ 3].z += Wr1(W[ 3].x) + W[ 1].w + Wr2(W[ 3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[61]); + + W[ 3].w += Wr1(W[ 3].y) + W[ 2].x + Wr2(W[ 0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[62]); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + + *state0 += S0; + *state1 += S1; +} + +void SHA256_fresh(uint4*restrict state0,uint4*restrict state1, const uint4 block0, const uint4 block1, const uint4 block2, const uint4 block3) +{ +#define A (*state0).x +#define B (*state0).y +#define C (*state0).z +#define D (*state0).w +#define E (*state1).x +#define F (*state1).y +#define G (*state1).z +#define H (*state1).w + + uint4 W[4]; + + W[0].x = block0.x; + D= K[63] +W[0].x; + H= K[64] +W[0].x; + + W[0].y = block0.y; + C= K[65] +Tr1(D)+Ch(D, K[66], K[67])+W[0].y; + G= K[68] +C+Tr2(H)+Ch(H, K[69] ,K[70]); + + W[0].z = block0.z; + B= K[71] +Tr1(C)+Ch(C,D,K[66])+W[0].z; + F= K[72] +B+Tr2(G)+Maj(G,H, K[73]); + + W[0].w = block0.w; + A= K[74] +Tr1(B)+Ch(B,C,D)+W[0].w; + E= K[75] +A+Tr2(F)+Maj(F,G,H); + + W[1].x = block1.x; + RND(E,F,G,H,A,B,C,D, W[1].x+ K[4]); + W[1].y = block1.y; + RND(D,E,F,G,H,A,B,C, W[1].y+ K[5]); + W[1].z = block1.z; + RND(C,D,E,F,G,H,A,B, W[1].z+ K[6]); + W[1].w = block1.w; + RND(B,C,D,E,F,G,H,A, W[1].w+ K[7]); + + W[2].x = block2.x; + RND(A,B,C,D,E,F,G,H, W[2].x+ K[8]); + W[2].y = block2.y; + RND(H,A,B,C,D,E,F,G, W[2].y+ K[9]); + W[2].z = block2.z; + RND(G,H,A,B,C,D,E,F, W[2].z+ K[10]); + W[2].w = block2.w; + RND(F,G,H,A,B,C,D,E, W[2].w+ K[11]); + + W[3].x = block3.x; + RND(E,F,G,H,A,B,C,D, W[3].x+ K[12]); + W[3].y = block3.y; + RND(D,E,F,G,H,A,B,C, W[3].y+ K[13]); + W[3].z = block3.z; + RND(C,D,E,F,G,H,A,B, W[3].z+ K[14]); + W[3].w = block3.w; + RND(B,C,D,E,F,G,H,A, W[3].w+ K[76]); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[15]); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[16]); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[17]); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[18]); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[19]); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[20]); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[21]); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[22]); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[23]); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[24]); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[25]); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[26]); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[27]); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[28]); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[29]); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[30]); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[31]); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[32]); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[33]); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[34]); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[35]); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[36]); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[37]); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[38]); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[39]); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[40]); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[41]); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[42]); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[43]); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[44]); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[45]); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[46]); + + W[0].x += Wr1(W[3].z) + W[2].y + Wr2(W[0].y); + RND(A,B,C,D,E,F,G,H, W[0].x+ K[47]); + + W[0].y += Wr1(W[3].w) + W[2].z + Wr2(W[0].z); + RND(H,A,B,C,D,E,F,G, W[0].y+ K[48]); + + W[0].z += Wr1(W[0].x) + W[2].w + Wr2(W[0].w); + RND(G,H,A,B,C,D,E,F, W[0].z+ K[49]); + + W[0].w += Wr1(W[0].y) + W[3].x + Wr2(W[1].x); + RND(F,G,H,A,B,C,D,E, W[0].w+ K[50]); + + W[1].x += Wr1(W[0].z) + W[3].y + Wr2(W[1].y); + RND(E,F,G,H,A,B,C,D, W[1].x+ K[51]); + + W[1].y += Wr1(W[0].w) + W[3].z + Wr2(W[1].z); + RND(D,E,F,G,H,A,B,C, W[1].y+ K[52]); + + W[1].z += Wr1(W[1].x) + W[3].w + Wr2(W[1].w); + RND(C,D,E,F,G,H,A,B, W[1].z+ K[53]); + + W[1].w += Wr1(W[1].y) + W[0].x + Wr2(W[2].x); + RND(B,C,D,E,F,G,H,A, W[1].w+ K[54]); + + W[2].x += Wr1(W[1].z) + W[0].y + Wr2(W[2].y); + RND(A,B,C,D,E,F,G,H, W[2].x+ K[55]); + + W[2].y += Wr1(W[1].w) + W[0].z + Wr2(W[2].z); + RND(H,A,B,C,D,E,F,G, W[2].y+ K[56]); + + W[2].z += Wr1(W[2].x) + W[0].w + Wr2(W[2].w); + RND(G,H,A,B,C,D,E,F, W[2].z+ K[57]); + + W[2].w += Wr1(W[2].y) + W[1].x + Wr2(W[3].x); + RND(F,G,H,A,B,C,D,E, W[2].w+ K[58]); + + W[3].x += Wr1(W[2].z) + W[1].y + Wr2(W[3].y); + RND(E,F,G,H,A,B,C,D, W[3].x+ K[59]); + + W[3].y += Wr1(W[2].w) + W[1].z + Wr2(W[3].z); + RND(D,E,F,G,H,A,B,C, W[3].y+ K[60]); + + W[3].z += Wr1(W[3].x) + W[1].w + Wr2(W[3].w); + RND(C,D,E,F,G,H,A,B, W[3].z+ K[61]); + + W[3].w += Wr1(W[3].y) + W[2].x + Wr2(W[0].x); + RND(B,C,D,E,F,G,H,A, W[3].w+ K[62]); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + + *state0 += (uint4)(K[73], K[77], K[78], K[79]); + *state1 += (uint4)(K[66], K[67], K[80], K[81]); +} + +__constant uint fixedW[64] = +{ + 0x428a2f99,0xf1374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, + 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf794, + 0xf59b89c2,0x73924787,0x23c6886e,0xa42ca65c,0x15ed3627,0x4d6edcbf,0xe28217fc,0xef02488f, + 0xb707775c,0x0468c23f,0xe7e72b4c,0x49e1f1a2,0x4b99c816,0x926d1570,0xaa0fc072,0xadb36e2c, + 0xad87a3ea,0xbcb1d3a3,0x7b993186,0x562b9420,0xbff3ca0c,0xda4b0c23,0x6cd8711a,0x8f337caa, + 0xc91b1417,0xc359dce1,0xa83253a7,0x3b13c12d,0x9d3d725d,0xd9031a84,0xb1a03340,0x16f58012, + 0xe64fb6a2,0xe84d923a,0xe93a5730,0x09837686,0x078ff753,0x29833341,0xd5de0b7e,0x6948ccf4, + 0xe0a1adbe,0x7c728e11,0x511c78e4,0x315b45bd,0xfca71413,0xea28f96a,0x79703128,0x4e1ef848, +}; + +void SHA256_fixed(uint4*restrict state0,uint4*restrict state1) +{ + uint4 S0 = *state0; + uint4 S1 = *state1; + +#define A S0.x +#define B S0.y +#define C S0.z +#define D S0.w +#define E S1.x +#define F S1.y +#define G S1.z +#define H S1.w + + RND(A,B,C,D,E,F,G,H, fixedW[0]); + RND(H,A,B,C,D,E,F,G, fixedW[1]); + RND(G,H,A,B,C,D,E,F, fixedW[2]); + RND(F,G,H,A,B,C,D,E, fixedW[3]); + RND(E,F,G,H,A,B,C,D, fixedW[4]); + RND(D,E,F,G,H,A,B,C, fixedW[5]); + RND(C,D,E,F,G,H,A,B, fixedW[6]); + RND(B,C,D,E,F,G,H,A, fixedW[7]); + RND(A,B,C,D,E,F,G,H, fixedW[8]); + RND(H,A,B,C,D,E,F,G, fixedW[9]); + RND(G,H,A,B,C,D,E,F, fixedW[10]); + RND(F,G,H,A,B,C,D,E, fixedW[11]); + RND(E,F,G,H,A,B,C,D, fixedW[12]); + RND(D,E,F,G,H,A,B,C, fixedW[13]); + RND(C,D,E,F,G,H,A,B, fixedW[14]); + RND(B,C,D,E,F,G,H,A, fixedW[15]); + RND(A,B,C,D,E,F,G,H, fixedW[16]); + RND(H,A,B,C,D,E,F,G, fixedW[17]); + RND(G,H,A,B,C,D,E,F, fixedW[18]); + RND(F,G,H,A,B,C,D,E, fixedW[19]); + RND(E,F,G,H,A,B,C,D, fixedW[20]); + RND(D,E,F,G,H,A,B,C, fixedW[21]); + RND(C,D,E,F,G,H,A,B, fixedW[22]); + RND(B,C,D,E,F,G,H,A, fixedW[23]); + RND(A,B,C,D,E,F,G,H, fixedW[24]); + RND(H,A,B,C,D,E,F,G, fixedW[25]); + RND(G,H,A,B,C,D,E,F, fixedW[26]); + RND(F,G,H,A,B,C,D,E, fixedW[27]); + RND(E,F,G,H,A,B,C,D, fixedW[28]); + RND(D,E,F,G,H,A,B,C, fixedW[29]); + RND(C,D,E,F,G,H,A,B, fixedW[30]); + RND(B,C,D,E,F,G,H,A, fixedW[31]); + RND(A,B,C,D,E,F,G,H, fixedW[32]); + RND(H,A,B,C,D,E,F,G, fixedW[33]); + RND(G,H,A,B,C,D,E,F, fixedW[34]); + RND(F,G,H,A,B,C,D,E, fixedW[35]); + RND(E,F,G,H,A,B,C,D, fixedW[36]); + RND(D,E,F,G,H,A,B,C, fixedW[37]); + RND(C,D,E,F,G,H,A,B, fixedW[38]); + RND(B,C,D,E,F,G,H,A, fixedW[39]); + RND(A,B,C,D,E,F,G,H, fixedW[40]); + RND(H,A,B,C,D,E,F,G, fixedW[41]); + RND(G,H,A,B,C,D,E,F, fixedW[42]); + RND(F,G,H,A,B,C,D,E, fixedW[43]); + RND(E,F,G,H,A,B,C,D, fixedW[44]); + RND(D,E,F,G,H,A,B,C, fixedW[45]); + RND(C,D,E,F,G,H,A,B, fixedW[46]); + RND(B,C,D,E,F,G,H,A, fixedW[47]); + RND(A,B,C,D,E,F,G,H, fixedW[48]); + RND(H,A,B,C,D,E,F,G, fixedW[49]); + RND(G,H,A,B,C,D,E,F, fixedW[50]); + RND(F,G,H,A,B,C,D,E, fixedW[51]); + RND(E,F,G,H,A,B,C,D, fixedW[52]); + RND(D,E,F,G,H,A,B,C, fixedW[53]); + RND(C,D,E,F,G,H,A,B, fixedW[54]); + RND(B,C,D,E,F,G,H,A, fixedW[55]); + RND(A,B,C,D,E,F,G,H, fixedW[56]); + RND(H,A,B,C,D,E,F,G, fixedW[57]); + RND(G,H,A,B,C,D,E,F, fixedW[58]); + RND(F,G,H,A,B,C,D,E, fixedW[59]); + RND(E,F,G,H,A,B,C,D, fixedW[60]); + RND(D,E,F,G,H,A,B,C, fixedW[61]); + RND(C,D,E,F,G,H,A,B, fixedW[62]); + RND(B,C,D,E,F,G,H,A, fixedW[63]); + +#undef A +#undef B +#undef C +#undef D +#undef E +#undef F +#undef G +#undef H + *state0 += S0; + *state1 += S1; +} + +void shittify(uint4 B[8]) +{ + uint4 tmp[4]; + tmp[0] = (uint4)(B[1].x,B[2].y,B[3].z,B[0].w); + tmp[1] = (uint4)(B[2].x,B[3].y,B[0].z,B[1].w); + tmp[2] = (uint4)(B[3].x,B[0].y,B[1].z,B[2].w); + tmp[3] = (uint4)(B[0].x,B[1].y,B[2].z,B[3].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i] = EndianSwap(tmp[i]); + + tmp[0] = (uint4)(B[5].x,B[6].y,B[7].z,B[4].w); + tmp[1] = (uint4)(B[6].x,B[7].y,B[4].z,B[5].w); + tmp[2] = (uint4)(B[7].x,B[4].y,B[5].z,B[6].w); + tmp[3] = (uint4)(B[4].x,B[5].y,B[6].z,B[7].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] = EndianSwap(tmp[i]); +} + +void unshittify(uint4 B[8]) +{ + uint4 tmp[4]; + tmp[0] = (uint4)(B[3].x,B[2].y,B[1].z,B[0].w); + tmp[1] = (uint4)(B[0].x,B[3].y,B[2].z,B[1].w); + tmp[2] = (uint4)(B[1].x,B[0].y,B[3].z,B[2].w); + tmp[3] = (uint4)(B[2].x,B[1].y,B[0].z,B[3].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i] = EndianSwap(tmp[i]); + + tmp[0] = (uint4)(B[7].x,B[6].y,B[5].z,B[4].w); + tmp[1] = (uint4)(B[4].x,B[7].y,B[6].z,B[5].w); + tmp[2] = (uint4)(B[5].x,B[4].y,B[7].z,B[6].w); + tmp[3] = (uint4)(B[6].x,B[5].y,B[4].z,B[7].w); + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] = EndianSwap(tmp[i]); +} + +void salsa(uint4 B[8]) +{ + uint4 w[4]; + +#pragma unroll + for(uint i=0; i<4; ++i) + w[i] = (B[i]^=B[i+4]); + +#pragma unroll + for(uint i=0; i<4; ++i) + { + w[0] ^= rotl(w[3] +w[2] , 7U); + w[1] ^= rotl(w[0] +w[3] , 9U); + w[2] ^= rotl(w[1] +w[0] ,13U); + w[3] ^= rotl(w[2] +w[1] ,18U); + w[2] ^= rotl(w[3].wxyz+w[0].zwxy, 7U); + w[1] ^= rotl(w[2].wxyz+w[3].zwxy, 9U); + w[0] ^= rotl(w[1].wxyz+w[2].zwxy,13U); + w[3] ^= rotl(w[0].wxyz+w[1].zwxy,18U); + } + +#pragma unroll + for(uint i=0; i<4; ++i) + w[i] = (B[i+4]^=(B[i]+=w[i])); + +#pragma unroll + for(uint i=0; i<4; ++i) + { + w[0] ^= rotl(w[3] +w[2] , 7U); + w[1] ^= rotl(w[0] +w[3] , 9U); + w[2] ^= rotl(w[1] +w[0] ,13U); + w[3] ^= rotl(w[2] +w[1] ,18U); + w[2] ^= rotl(w[3].wxyz+w[0].zwxy, 7U); + w[1] ^= rotl(w[2].wxyz+w[3].zwxy, 9U); + w[0] ^= rotl(w[1].wxyz+w[2].zwxy,13U); + w[3] ^= rotl(w[0].wxyz+w[1].zwxy,18U); + } + +#pragma unroll + for(uint i=0; i<4; ++i) + B[i+4] += w[i]; +} + +#define Coord(x,y,z) x+y*(x ## SIZE)+z*(y ## SIZE)*(x ## SIZE) +#define CO Coord(z,x,y) + +void scrypt_core(uint4 X[8], __global uint4*restrict lookup) +{ + shittify(X); + const uint zSIZE = 8; + const uint ySIZE = (1024/LOOKUP_GAP+(1024%LOOKUP_GAP>0)); + const uint xSIZE = CONCURRENT_THREADS; + uint x = get_global_id(0)%xSIZE; + + for(uint y=0; y<1024/LOOKUP_GAP; ++y) + { +#pragma unroll + for(uint z=0; z 1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh +GPU mining and refactor: Con Kolivas 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ +Bitfury GPIO-based drivers: Bitfury and Anatoly Legkodymov +Big Picture Mining driver: Andreas Auer +Avalon and Icarus drivers: Xiangfu +ZTEX FPGA driver: Nelisky +Original CPU mining software: Jeff Garzik +RPC API: Andrew Smith 1Jjk2LmktEQKnv8r2cZ9MvLiZwZ9gxabKm + +SUSE packaging: Christian Berendt +Ubuntu packaging: Graeme Humphries + +Contributors: + +Nate Woolls +Jason Hughes +Ycros +Denis Ahrens +blinkier +Peter Stuge +Paul Sheppard +Vladimir Strinski +Dmitry Sorokin +Jason Snell +Mark Crichton +Zefir Kurtisi +HashBuster team +bluemurder +Philip Kaufmann +Rusty Russell +Znort 987 +Phateus +Olivier Gay +Glenn Francis Murray +fleger +pooler +Ricardo Iván Vieitez Parra +gluk +Paul Wouters +Abracadabra +Josh Lehan +pontus +Tydus +Raulo +Thorsten Gilling +Isidoro Ghezzi +capa66 +Red_Wolf_2 +Mr O diff --git a/bfgminer3.9/share/doc/bfgminer/COPYING b/bfgminer3.9/share/doc/bfgminer/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/bfgminer3.9/share/doc/bfgminer/COPYING_fpgaminer b/bfgminer3.9/share/doc/bfgminer/COPYING_fpgaminer new file mode 100644 index 0000000..ad0f7c1 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/COPYING_fpgaminer @@ -0,0 +1,23 @@ +All the bitstream files included in this directory that follow the name pattern fpgaminer_*.bit are: + +---- + +Copyright (c) 2011-2012 fpgaminer@bitcoin-mining.com + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +---- + +You can find the original sources at the Open Source FPGA Bitcoin Miner project GitHub repository: +https://github.com/progranism/Open-Source-FPGA-Bitcoin-Miner/tree/master/projects/X6000_ztex_comm4/hdl diff --git a/bfgminer3.9/share/doc/bfgminer/COPYING_ztex b/bfgminer3.9/share/doc/bfgminer/COPYING_ztex new file mode 100644 index 0000000..99cd2ed --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/COPYING_ztex @@ -0,0 +1,24 @@ +All the bitstream files included in this directory that follow the name pattern ztex_*.bit are: + +---- + +Copyright (C) 2009-2011 ZTEX GmbH. +http://www.ztex.de + + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 3 as +published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, see http://www.gnu.org/licenses/. + +---- + +You can find the original sources at the BTCMiner project home page: http://www.ztex.de/btcminer/ + diff --git a/bfgminer3.9/share/doc/bfgminer/HACKING b/bfgminer3.9/share/doc/bfgminer/HACKING new file mode 100644 index 0000000..e8e68b9 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/HACKING @@ -0,0 +1,125 @@ +Driver API +========== + +NOTE: This API is subject to change. It is recommended that you submit your +driver, even if obscure, to the mainline BFGMiner codebase so that it will be +updated when the API changes. + +BFGMiner defines 3 different units that drivers can use: +- "Device" is a logical unit used for mining. It is represented by its first + processor's `struct cgpu_info`. Example: ButterFly Labs MiniRig SC. +- "Processor" is a logical work processing unit. It is represented by a `struct + cgpu_info` and one or more `struct thr_info`. Example: a single board within + ButterFly Labs MiniRig SC. +- "Thread" is a sequence of instructions and stack that manages hashing on one + or more Processors within a single Device. It is represented by a `struct + thr_info`. + +It should be noted that while every Processor has a `struct thr_info`, this may +not represent the same Thread which is managing hashing on the Processor. +Instead, this `struct thr_info` is only used to store status information needed +for the Processor, and is maintained by the managing Thread in addition to its +own `struct thr_info`. New drivers are encouraged to use an asynchronous model +to manage as many Processors as possible within a single Thread. + +struct device_drv basics +------------------------ + +Every driver defines a `struct device_drv`. The `dname` field contains a +short name of the driver. This should consist only of lowercase alphabetic +characters, and be the same name used in the source file: driver-foobar.c +defines `dname` "foobar". The `name` field contains a three-letter abbreviation +for the device, used in the representation of devices. For example, `dname` +"FOO" would result in devices represented as "FOO 0", "FOO 1", etc and +processors represented as "FOO 0a", "FOO 0b", etc. + +Drivers must define a function `drv_detect`, which is run at startup to detect +devices. For each device (note: NOT each processor), it should allocate a +`struct cgpu_info`, set some basic parameters on it, and call the `add_cgpu` +function with it as an argument. Various values you can initialize are: + .drv This MUST be set to your driver's `struct device_drv`! + .deven Should be set to DEV_ENABLED + .procs Number of Processors for this device + .threads Number of threads your device needs - should be either a + multiple of .procs (threads will be allocated to each + Processor), or one (a single thread will be allocated only to + the Device, to manage all Processors) + .name Null-terminated name of the device itself +`drv_detect` should return the total number of devices created. It should leave +the device in an unused state, as the user may opt to delete it outright. + +Threads +------- + +The first interaction BFGMiner will have with a device is by calling the +driver's `thread_prepare` function for each Thread. This occurs while BFGMiner +is still in a single-threaded state, before any Threads have actually started +running independently. It should do only the minimal initialization necessary +to proceed, and return true iff successful. + +Once all the Threads are setup, BFGMiner starts them off by calling the +`thread_init` function. This should do all initialization that can occur in +parallel with other Threads. + +The driver should specify a `minerloop` to use. For the purposes of this +document, it is assumed you will be using `minerloop_async`. Please note that +the default is currently `minerloop_scanhash`, and much of the documentation +here will NOT work with this `minerloop`. + +Processors +---------- + +Processors work with `struct work` objects, which each represent a block header +to find a solution for. Before your driver sees a `struct work`, it will be +passed to the function `prepare_work` with pointers to the Processor `struct +thr_info` and the `struct work` as arguments. Most drivers do not need to do +anything at this stage, so feel free to omit the `prepare_work` function. + +For each job, the `job_prepare` function is called in advance, with three +arguments: Processor `struct thr_info *`, `struct work *`, and a `uint64_t` +limiting how many nonces to check (starting from `work->blk.nonce`). Unless you +implement a `can_limit_work` function, you will always receive a full nonce +range from 0 to 0xffffffff. `job_prepare` increments `work->blk.nonce` to the +last nonce the processor will be attempting and returns true when successful. +Please note this will be called while the previous job is still executing. + +When it is time to actually start the new job, the `job_start` function will be +called. This is given the Processor `struct thr_info *` as its only argument, +and should start the job most recently prepared with `job_prepare`. Note that +it is possible for `job_prepare` to be called for a job that never starts +(another `job_prepare` may be executed to override the previous one instead). +`job_start` must call `mt_job_transition` as soon as the actual switchover to +the new job takes place, and must call `job_start_complete` when successful; +in case of a failure, it should call `job_start_abort` instead. `job_start` +must set `thr->tv_morework` to the time the device expects to need its next +work item. It is generally advisable to set this a bit early to ensure any +delays do not make it late. `job_start` is expected to always succeed and does +not have a return value. + +Immediately before `job_start` is called to change from one job to the next, +`job_get_results` will be called to fetch any volatile results from the +previous job. It is provided the Processor's `struct thr_info *` and the +currently executing job's `struct work *`. It should ONLY fetch the raw data +for the results, and not spend any time processing or submitting it. If +`job_get_results` is defined for your driver, it must (directly or indirectly) +ensure `job_results_fetched` is called when complete (including the case of +failure). After the new job has been started, your driver's +`job_process_results` function will be called to complete the submission of +these results with the same arguments, plus a bool to tell you whether the +processor is being stopped. If it is, your driver must call `mt_disable_start` +when it has successfully stopped hashing. + +Drivers may define a `poll` function. If this is defined, `thr->tv_poll` must +always be set to a valid time to next execute it, for each Processor. + +Whenever a solution is found (at any point), the function `submit_nonce` should +be called, passing the Processor `struct thr_info *`, `struct work *`, and +nonce as arguments. If the solution is invalid (any of the final 32 bits of the +hash are nonzero), it will be recorded as a hardware error and your driver's +`hw_error` function (if one is defined) will be called. + +As often as results are processed, your driver should call the `hashes_done` +function with a number of arguments: Processor `struct thr_info *`, count of +hashes completed (including calls to `submit_nonce`), a `struct timeval *` +that tells how long it took to find these hashes (usually time since the last +call to `hashes_done`, and a `uint32_t *` which should usually be NULL. diff --git a/bfgminer3.9/share/doc/bfgminer/NEWS b/bfgminer3.9/share/doc/bfgminer/NEWS new file mode 100644 index 0000000..8d5ae40 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/NEWS @@ -0,0 +1,6469 @@ +BFGMiner Version 3.9.0 - December 25, 2013 + +- Update official Win32 build compiler and library: +- - Upgrade GCC from 4.8.1 to 4.8.2 +- - Upgrade libcurl from 7.28.1 to 7.34.0 +- Update official Win64 build compiler and library: +- - Upgrade GCC from 4.7.3 to 4.8.2 +- - Upgrade mingw64-runtime from 2.0.8 to 3.0.0 +- Green-on-red title colours for Christmas release +- write_config: Include http-port and stratum-port options +- Interpret F1 as a request for Help +- Bugfix: SSM: Free old _ssm_notify before replacing it +- Bugfix: SSM: Clean _ssm_cur_job_work as needed to avoid memory leaks +- Support matching --scan with lowlevel devid +- cgpu_match: Unit test for USB device path matching +- Bugfix: cgpu_match: Handle digits in dname (x6500) +- cgpu_match: More unit tests (dname with digit) +- cgpu_match: More unit tests (dname and case insensitivity) +- Display "NO DEVICES FOUND" line in place of device list, when there are none +- bitfury: Use drv_set_defaults to enable setting baud before probe +- bitfury: Split out SPI port configuration option ("baud") to its own function +- drv_set_defaults wrapper function around cgpu_set_defaults for use with +options that may need to be set during probe +- bitfury: Set poll interval to start iteration before responses are processed +- modminer: Check identification begins with "ModMiner" to avoid false detection +- Bugfix: hashbusterusb: Correct return value of hashbusterusb_vrm_unlock +- Support for installing a udev rules file for Linux +- twinfury: Remove unused variable to silence warning +- cgpu_request_control should be a noop when called from the main thread +- Bugfix: Handle errors creating a vcom devid more gracefully +- Bugfix: _wlog: Allocate enough space for complete copy of log line +- bfsb: Remove unused clock_gettime +- Bugfix: bfsb: Remove useless slot_on which was never properly initialised +- Bugfix: When QueryDosDevice fails, skip trying to parse its (undefined) +results +- hashbusterusb: Voltage should be in volts (not millivolts) for RPC +- hashbusterusb: Provide access to VRM stuff from RPC +- hashbusterusb: Use cgpu_request_control interface to safely access device from +outside main thread +- hashbusterusb: Include Voltage in RPC stats +- Bugfix: hashbusterusb: Ensure unlock code is always allocated, even if null +- hashbusterusb: Abstract code into hashbusterusb_vrm_lock +- hashbusterusb: Abstract code into hashbusterusb_vrm_unlock +- hashbusterusb: Abstract code into hashbusterusb_set_voltage +- Bugfix: hashbusterusb: Check for voltage change error correctly +- Abstract mutex_request code from X6500 driver into generic device API +interface +- hashbusterusb: Use standard identification behaviour +- hashbusterusb: Abstract hashbusterusb_set_colour function +- hashbusterusb: Get voltage with temperature +- hashbusterusb: Clean up unused variable warnings +- hashbusterusb: Use bitfury_wlogprint_status for osc6_bits displaying in Manage +TUI +- Bugfix: hashbusterusb: Remove ignored prompt for VRM lock +- hashbusterusb: Use Manage/osc6_bits code from main bitfury driver +- hashbusterusb: Provide access to VRM and identification in Manage TUI +- hashbusterusb: Shutdown PSU +- nanofury: Support identify function by turning off LED for 5 seconds +- nanofury: nanofury_state structure +- bitfury: Set poll interval to start iteration before responses are processed +- Twinfury: moved voltage reading to the thread init function +- Twinfury supply voltage initial reading: error log improved +- Twinfury: Reading supply voltage on startup +- Voltage scaling for twinfury implemented + + +BFGMiner Version 3.8.1 - December 9, 2013 + +- bfgminer-rpc: Catch error when server host fails to resolve to an IP +- RPC: Remove unnecessary delay from RPC server startup +- Call WSAStartup for our own needs independently of libcurl etc +- hashbusterusb: Give more meaningful errors before serial number is known +- hashbusterusb: Populate device_path with USB devid +- Rename hashbuster2 to hashbusterusb (only a-z allowed in driver names) +- Include libusb in options list, since it is no longer tied to specific drivers +- Make hashbuster serial number output match formatting on physical board +- Fix for hashbuster first init after power up +- Workaround Microsoft's non-standard swprintf +- vcom: Fabricate vcom devinfo for any existing paths specified to --scan, in +case enumeration fails +- Bugfix: hashbuster2: Check for errors setting up libusb handle +- Bugfix: Draw statuswin in line order to ensure overflow is cutoff properly +- Fixed one byte stack overflow in mcast recvfrom. +- Bugfix: Let libc do any translation for %lc before adding wide characters to +curses +- Specifically handle mining.get_transactions failures so they get logged at the +lower debug loglevel +- Bugfix: lowlevel: Use LL_DELETE2 when cleaning up secondary list + + +BFGMiner Version 3.8.0 - December 1, 2013 + +- Bugfix: lowl-usb.h: Add missing includes for stdbool/stdint +- hashbuster2: Retry writing request if no response received in 100ms +- lowl-usb: usb_ep_set_timeouts_ms function that behaves similar to termios +VTIME (timeout before begin of read/write) +- hashbuster2: Use new lowl_usb_endpoint for i/o +- lowl-usb: Add tools for more reliable read/write using bulk transfers +- Add bytes_extend_buf, bytes_preappend, bytes_postappend for reading direct to +a bytes_t +- New / updated instructions for building bfgminer on Windows +- configure: Adjust header-path discovery to work sanely with spaces and +backslashes in paths +- Bugfix: configure: More fixing BSD sed syntax for curses header search +- bitfury: Reinitialise chips if their frequency drops over 50% +- bfg_strerror: Trim C whitespace off the right of FormatMessage output, since +Windows can add \r\n +- Demote commonish errors to debug loglevel +- klondike: Add support for Avalon2-based designs +- klondike: Remove unnecessary limit of 999 on clock speed displayed in Manage +Device +- Bugfix: hashbuster2: Claim USB device internally +- Bugfix: hashbuster2: Do not try to use lowl-hid.h +- Bugfix: hashbuster2: Close device and free memory allocated, when no chips are +found +- Bugfix: hashbuster2: Remove libusb init and debug level setting +- Bugfix: hashbuster2: Avoid add_cgpu when no chips found +- Bugfix: klondike: Claim USB device internally +- Bugfix: devpath_to_devid: Check stat for error before allocating memory +- Bugfix: lowlevel: Free hash table data when done with it +- Bugfix: bifury: Free memory used by version reply +- bfgtls: Implement destructor to free memory when threads exit +- hashbuster2: Remove unnecessary libusb_detach_kernel_driver +- hashbuster2: Read unique serial number from device +- hashbuster2: Use hashbuster2_io for probe +- hashbuster2: Clean up warnings about unused variables +- README: Document --enable-opencl configure option +- README: Update for HashBuster Micro +- hashbuster2: Integrate into BFGMiner as a separate driver +- hashbuster2: Import driver for new protocol +- Bugfix: nanofury: Check if mcp2210_device exists before trying to power it off +- Bugfix: lowl-vcom: Check for error getting root hub path +- openwrt: Update package description +- configure: Add --without-libusb option to explicitly disable using it +- Bugfix: Pass newlines as ASCII (fixes lack of them in non-unicode builds) + + +BFGMiner Version 3.7.0 - November 27, 2013 + +- FTDI scan: Use intptr_t to avoid warning about different size type cast +- Bugfix: proxy: Add missing unistd.h include +- Bugfix: bifury: Precision specifications should be int, not size_t +- Bugfix: klondike: Include config.h first +- Bugfix: binloader: Include config.h first +- README.ASIC: Include support URI for bi*fury driver and firmware +- Added MultiMiner as an example of a GUI application that wraps bfgminer using +the RPC interface +- Silence non-issue warnings +- bifury: Add support for hwerror message +- inc_hw_errors2: Support reporting hw errors without a known nonce +- bifury: Initialise cutofftemp to 75 C +- bifury: Turn chips off and on when disabled and enabled +- bifury: Split out bifury_send_clock +- Bugfix: bifury: Avoid double-free and double-close on version parse errors +during probe +- bifury: Add support for clock command +- bifury: Update for "job" protocol change +- bifury: Update to current git +- bifury: Workaround bugs in older firmware by flooding device with work until +it proves it has needwork +- bifury: Attempt to submit shares even if maxroll limit is ignored +- Clone cgminer's submit_noffset_nonce interface +- Bugfix: bifury: Check that there is a line before comparing it to "version " +- bifury: Prune jobs older than 16 queued, to eventually clean up discarded work +(from flushes) +- Replace ucs2tochar* with ucs2_to_utf8* to handle Unicode +- README.ASIC: Document Bi*Fury firmware upgrade +- bifury: Free work when we know it's complete +- bifury: Implement hashrate reporting using "job" messages +- bifury: Tolerate other data before version reply +- bifury: Abstract line parsing into bifury_readln function +- Bugfix: bifury: Use a char array, rather than pointer to char array, for +bifury_init_cmds +- bifury: Unify SEND devprotodump logging code +- fpgautils: Skip SetCommConfig on Windows if baud is not to be set +- Check for U+2022 and replace it with "*" is unprintable +- Use replacement character for non-printable Unicode +- Use UTF-8 for Unicode +- Implement a utf8_decode function to produce wchar_t needed by curses +- bifury: New driver +- Bugfix: twinfury: Handle flash request for both chips, and avoid using proc +uninitialised +- Bugfix: twinfury: Fix various technicalities +- Bugfix: twinfury: Remove incorrect tcflush +- Twinfury communication protocol changed to be more robust. A preamble is sent +before the actual command. +- LED flashing changed: - setting a flag and flash the LED during the poll +cycle - mutex removed +- Renamed bf2 driver -> twinfury driver bin2hex utility used to convert the +serial number +- BF2 driver comment edited +- BF2 - Twin Bitfury USB miner driver added +- Deprecate --ndevs|-n (redundant with -d? and GPU-only) +- Never abort startup just because we have no devices (there may be cases this +is pointless, but at least it's consistent) +- cgpu_match: Accept ranges for letter processor specification +- cgpu_match: Accept ranges for numeric elements +- test_cgpu_match: Test with more than one device/processor +- configure: Condense configuration options summary a bit +- configure: Put configuration options summary back after everything completes +- Workaround bug in MinGW-w64: Check for strtok_r to be defined at compile-time, +and don't override it unless we really want to override +- Bugfix: configure: Use new need_lowl_vcom instead of need_fpgautils +- configure: Explicitly check for sleep +- Bugfix: Set LIBUSB_LIBS for non-pkgconf non-header-subdir libusb installations +- Move unused winsock2.h includes to the end of config.h +- Use lround instead of llround, since it has better compatibility with older +MingW and Cygwin versions +- lowl-hid: Save and use hid_enumerate results from library test +- Silence Windows build warnings +- mcp2210: Remove cruft leftover from HID code (moved out) +- lowl-vcom: sysfs scan: Simplify maybe_strdup into _sysfs_do_read +- lowl-vcom: sysfs scan: Don't bother getting product string until we confirm it +is in fact a tty device +- input_pool: Accept a null password +- Bugfix: Move const data into the scope it needs to be in +- Bugfix: Restore case insensitivity to --scan driver names +- Accept "@" separator for serial/path in --scan to match --device and +--set-device better +- README: Uppercase the sequence letter when talking about multiple pools +- README: Mention "make install" and clarify saving settings +- Bugfix: avalon: Don't "probe" with -S +- bitforce: Add lowl_* to bitforce_queue so it can be specified by name as a +driver +- Bugfix: devpath_to_devid: Be strict about COM port specifications on Windows +- Bugfix: avalon: Don't "probe" with -S all +- Bugfix: Only count devices in -d? +- RPC: {dev,proc}details: Add 'Processors', 'Manufacturer', 'Product', +'Serial', 'Target Temperature', 'Cutoff Temperature' +- debian: Need to explicitly add opencl support to build. +- Correctly document klondike as being enabled by default +- Simplify logic for README.ASIC and README.FPGA install +- Split fpgautils into lowl-vcom and binloader, and fix internal build +dependencies +- Add README.CPU to "make install" distribution when built with CPU mining +support +- line 2913 added urlencode +- Bugfix: RPC: Release apisock on error in tidyup +- klondike - dont try to flush if not initialised +- Rename --scan-serial to --scan +- Bugfix: Handle invalid driver names cleanly +- Workaround libcurl bug to properly support HTTP proxies for stratum +- Bugfix: Write klondike options for klondike-options (not icarus options) +- README.OpenWrt: Change example repository to "latest", and document +alternatives +- mcp2210: Add support for --device-protocol-dump +- Bugfix: Initialise dynamic osc6_bits variables +- README: Fixed a few typos here and there and improved wording (Thanks +miningpenguin!) +- README: Moved CPU sections to README.CPU and elaborated more on it +- README*: Grammatical cleanups +- README.ASIC: More KnCMiner +- README.ASIC: Add section about KnCMiner +- Bugfix: opencl: Dynamic mode should disable threads for this device, not just +N after the first +- Bugfix: Make curses_input return NULL on a blank line, as most callers expect +- Duplicate (hidden) --userpass option before --pool-priority so it can be used +in config files +- Only probe VCOM devices on bare "all" scan-serial request +- Provide backports of uthash LL_{PREPEND,FOREACH{,_SAFE}}2 (only added in +1.9.7, not yet in major distros) +- Upgrade required uthash version to 1.9.4 for LL_CONCAT +- README: Update documentation for scan-serial +- README: Bitstreams no longer included with BFGMiner source +- README: Remove incomplete and unnecessary list of ASIC/FPGA devices +- write_config: Add scan-serial and set-device +- write_config: Update to make JSON Array of named parameters +- Remove support for comma-separated values in --device, and update +documentation +- lowlevel: Collapse multiple lowlevel drivers on the same devid to a secondary +linked list, and only spawn one thread to probe all lowlevels on a given devid +- Bugfix: vcom_devinfo_scan: Clean up hashtable when done +- README: Update cgminer driver FAQ with Windows-specific answer, now that we +have a workaround for *nix +- cpu/opencl: Always disable by default; removes deprecated -G option entirely +- vcom_lowl_probe_wrapper: Attempt to reattach detached USB devices +- Bugfix: erupter: Prioritise Emerald after Sapphire +- Bugfix: Allow "drv:auto" to override general "noauto" +- Bugfix: _probe_device_match: Fix inverted logic +- Bugfix: Don't try to call lowl_probe for drivers that don't support that +interface +- lowl-hid: Use usb devids for libusb-based hidapi devices +- Replace bfg_claim_hid with lowlevel_claim +- lowlevel: Generic claim interface for lowlevel info +- cgpu_match: Compare dev_t under paths +- Rework -d? output to display more useful information now that device ordering +is non-deterministic +- cgpu_match: Add support for matching by serial number or path +- Unit tests for cgpu_match +- Rework --device option to accept a pattern and JSON Array in config; removes +support for processor ranges +- Remove --remove-disabled option, as it conflicts with hotplug, per-processor +stuff, etc already +- Bugfix: Reimplement "noauto" flag +- Bugfix: Restore "-S foo" without driver name functionality +- Bugfix: scan-serial: Compare dev_t as well +- littlefury: Convert to lowl_probe +- hashbuster: Convert to lowl_probe +- avalon: Convert to lowl_probe +- cairnsmore/erupter/icarus: Convert to lowl_probe +- bigpic: Convert to lowl_probe +- ztex: Convert to lowl_probe +- x6500: Convert to lowl_probe +- nanofury: Convert to lowl_probe +- modminer: Convert to lowl_probe +- klondike: Convert to lowl_probe +- bitforce: Convert to lowl_probe +- fpgautils: Wrapper to easily adapt an old detectone to new lowl_probe +- lowlevel: Add match variants of detect functions +- DevAPI: add_cgpu: Use mutex to ensure thread safety +- Make detectone_meta_info thread-local +- New threaded device probe framework + + +BFGMiner Version 3.6.0 - November 12, 2013 + +- RPC: Bump to 2.2 for Works in POOLS +- Bugfix: klondike: Don't try to free off the stack +- configure: Update klondike checks for libusb +- klondike: Autodetect by VID/PID/Manufacturer, rather than too-short "K16" +Product search +- Remove accidentally added ASIC-README +- klondike: Remove noop identify function +- klondike: Replace deprecated statline with temperature and ManageTUI stuff +- --shares should be scaled to diff1 not absolute number of shares +- More README updates. +- Minor README updates. +- sha2 allow external access to some macros and the K array +- klondike: Fixed a math issue when reporting fan speed on the status line. +- Add a get and queue helper work function. +- Reset the work_restart bool after the scanwork loop in case the driver flushes +work synchronously. +- Get rid of the stage thread since all work can be asynchronously added now via +hash_push anyway. +- Fix for opt_worktime on big endian machines. +- Do get_work in fill_queue without holding other locks. +- Make hash_pop signal the work scheduler each time it waits on the conditional +that it should look for more work. +- Remove discarded work from quota used. +- Display works completed in summary and API data. +- Store how many work items are worked on per pool. +- Add the ability to add uint8 and uint16 entities to api data. +- klondike - initialise stat_lock +- klondike - better to unlock locks than to lock them twice :) +- Remove roundl check and define +- 'llround' is more suitable here than 'roundl' +- klondike - change options to clock and temptarget only +- klondike - fix another uninit dev warning +- klondike - downgrade 'late update' but add an idle detect - and correct error +levels +- klondike - fix isc uninit warning +- klondike - drop the device for hotplug if it's unresponsive +- klondike - single 'shutdown' and ensure it happens +- klondike remove SCNu8 - unsupported on windows +- klondike - fix uninitialised dev bug +- Don't attempt to disable curses or print a summary during an app restart to +prevent deadlocks. +- klondike - error condition handling +- Modify Makefile to only include opencl related code when configured in. +- Convert opencl to need to be explicitly enabled during build with +--enable-opencl +- Implement a cglock_destroy function. +- Implement a rwlock_destroy function. +- Implement a mutex_destroy function. +- Simplify queued hashtable by storing unqueued work separately in a single +pointer. +- Add cgminer compatibility macro for ms_tdiff +- klondike rewrite work control +- allow __work_complete() access +- miner.h allow devices to tv_stamp work +- klondike - can only calculate the nonce difference on or after the 2nd nonce +- klondike - correct/reverse min/max stats +- klondike: Remove unnecessary devlock +- klondike - use a link list queue rather than a circular buffer - and add +timing stats +- Klondike - increase circular read buffer size +- Klondike - extra zero value and range checking in temp conversion +- klondike - display MHz also +- klondike correct cvtKlnToC() temperature calculation +- klondike - correct 1st reply debug based on define +- klondike - debug dump structured replies +- klondike - avoid division by zero if maxcount is unexpectedly zero +- klondike store and report errorcount and noise +- klondike - fix chipstats api stats buffer overrun with 16 chips +- klondike add new nonecount only once +- klondike - report mh/s based on nonces found + put old estimate into API stats +- klondike use a memcpy +- klondike fix bracket tabs indenting +- klondike: Update code to current git +- Klondike update code to current git +- Add Klondike to README +- Add Klondike to README.ASIC +- Klondike to main directory +- Klondike consistent code spacing +- Klondike update driver code to current git +- klondike: update firmware for 16 chips, add dist files +- klondike: beta final 0.3.0 release +- klondike: updated firmware, IOC method +- klondike: prevent nonces when not state W +- klondike: added driver config option support +- klondike: fixes for 300 MHz, fix K1 parts list +- klondike: update driver, docs +- klondike: update firmware & utils +- klondike: updated cgminer driver for 3.3.1 +- klondike: update firmware and driver, create new cgminer fork +- update klondike driver +- klondike: add cgminer driver file as-is + + +BFGMiner Version 3.5.2 - November 12, 2013 + +- README.scrypt: Update to reflect current status of code (unmaintained); remove +Con's litecoin donation address (leaving his bitcoin one) since it is unknown if +he still accepts donations with litecoin +- Bugfix: minerloop_async: Check the correct _mt_disable_called flag +- bitforce: Allow ZCX response to override Manufacturer string +- Bugfix: RPC: Restore null termination on responses +- Bugfix: configure: We need DLOPEN_FLAGS for lowlevel hid too +- Add additional debug information to help track work through BFGMiner +- README: Update hidapi dependency for HashBuster +- Bugfix: bigpic: Convert device serial and nonces to host endian +- Bugfix: modminer: Ensure devices that fail probe are closed properly +- Bugfix: bitforce: Ensure devices that fail probe are closed properly +- Bugfix: littlefury: Ensure devices that fail probe are closed properly +- Bugfix: bigpic: Ensure devices that fail probe are closed properly +- nanofury: Attempt to be more resilient to problems + + +BFGMiner Version 3.5.1 - November 7, 2013 + +- Bugfix: make-release: Add README.GPU document +- Demote USB string fetch failure to LOG_DEBUG since it is rather common +- Bugfix: RPC: devscan shouldn't be available to read-only access +- Bugfix: bigpic: Ignore the bitfury chip's counter as best we can +- Bugfix: bigpic: Accept other delimiters in Bitfury BF1 product string in +autodetection +- Bugfix: Fix VCOM/fpgautils build check +- Bugfix: Only include VCOM code when VCOM/fpgautils support is being built +- Bugfix: Reimplement scan-serial "all" keyword +- Bugfix: bitforce detect: Close device after ZGX failure +- Bugfix: Define lowl_usb even if libusb support is omitted, since VCOM and HID +drivers check against it for warnings + + +BFGMiner Version 3.5.0 - November 6, 2013 + +- bigpic: Probe sooner than most drivers, but still after icarus/erupter +- cpu/opencl: Fix probe priorities to be last +- Bugfix: RPC: Correct per-device Work Utility to be per-minute instead of +per-second +- Bugfix: Fix Windows VCOM enumeration to work with new lowlevel code +- Bugfix: nanofury: Use maybe_strdup in case strings may be missing +- Bugfix: bitfury: Fix processor disable/enable for all bitfury-based devices +- hashbuster: Get temperature when available +- Bugfix: hashbuster: Use maybe_strdup where there might not be a string +- hid: Treat null-length strings as missing entirely +- hashbuster: Enable dynamic osc6_bits +- hashbuster: New driver +- Split a hid lowlevel out of mcp2210 +- ztex: Convert to use lowlevel usb enumerator +- A quick flag to allow drivers to convey the desire to rescan devices (from +lowlevel up) +- Lowlevel USB enumerator for libusb +- dname for lowlevel drivers +- Bugfix: lowlevel: Avoid null pointer dereference on devices that are missing +USB strings +- lowlevel: Add a userpointer to lowl_found_devinfo_func_t and use it for +serial_autodetect +- Rework VCOM autodetection to go through lowlevel interface, avoiding repeat +USB string fetching +- lowlevel: Keep track of the claimed devid and debuglog every found device +- ft232r: devinfo_scan: Don't skip claimed USB devices +- ft232r: Be more tolerant of USB open failure or missing strings +- RPC: Build most of CONFIG "Device Code" by iterating over registered driver +list +- drv_detect_all: Use priority-sorted list of registered drivers +- Build hash tables to find drivers by dname or name +- Build a linked list of registered drivers +- BFG_REGISTER_DRIVER macro to commonly pre-define device_drv structures +- Move have_libusb checks out of drv_detect_all +- Replace opt_nogpu with simple function that adds opencl:noauto to scan-serial +list +- opencl: Remove ancient gpu_threads variable, not really needed anymore +- Bugfix: Stop waiting for pool testing as soon as one is active +- bitfury: Clean up by making private functions static, and naming public ones +with [lib]bitfury_ prefix +- bitfury: Remove old (unused) driver code +- bitfury_gpio: Convert to using current bitfury driver code +- Bugfix: littlefury: Upgrade to use current bitfury driver (old one didn't work +with littlefury anymore anyway) +- Bugfix: test_work_current: Make hexstr buffer large enough for blkhashstr +later on (issuing old work msg) +- README: Document --enable-knc configure option +- README: Document --disable-nanofury configure option +- Windows autodetect: clear detectone meta info +- Check for Windows DDK headers, and where they are (and build without them if +unavailable) +- Windows SetupAPI-based detection for USB VCOM devices (tested with CP210x and +CDC) +- ucs2tochar{,_dup} functions to convert USB string descriptors to char* format +- bfg_strerror: Support for Windows system errors +- Introduce applogfail* macros +- Bugfix: scrypt: Add missing include stdbool.h +- Bugfix: Explicitly cast uses of be32toh to uint32_t +- Bugfix: Add missing includes of config.h, stdbool.h, and stdint.h +- lowlevel: Convey device manufacturer up to nanofury cgpus +- nanofury: Store device HID path for RPC +- lowlevel: Promote path to a normal element for devices to simplify things a +bit +- nanofury: Claim mcp2210/hid devices +- mcp2210: Implement claim on HID paths +- fpgautils: Use string identifiers for internal hardware claims +- ztex: Keep interface claimed as a lock +- Bugfix: mcp2210: Check for NULL hid device strings before trying to convert +them to ASCII +- FTDI autodetect: Enable populating USB product and serial number +- Bugfix: FTDI autodetect: Add missing parameter values and remove unused buffer +- Bugfix: bigpic: Don't active poll event without a poll function + + +BFGMiner Version 3.4.0 - October 26, 2013 + +- Bugfix: knc: Use separate DEV_RECOVER_DRV deven when doing automatic core +disable/re-enable, so user-initiated disables are left alone +- Document existing enum dev_enable usage +- Bugfix: knc: Only try to re-enable cores after we've actually asserted them as +disabled, otherwise we won't actually assert the enable either +- knc: Automatically disable and re-enable problematic cores +- AUTHORS: Add Dmitry Sorokin +- bitfury: Disable dynamic osc6_bits when manually setting a specific value +- bitfury_do_io: Make use of timer_elapsed +- bitfury: Only use dynamic osc6_bits with boards that support it explicitly +(BFSB and Metabank for now) +- bitfury: More debugging info for dynamic osc6_bits +- Bugfix: bitfury: Fix tv_stat to persist +- bitfury: Remove useless debugging +- bitfury: Simplify dynamic osc6_bits logic such that the range is defined in +one place +- bitfury: Remove unused skip_stat +- Bugfix: bitfury: Stick to tracking best_done per-chip, and never call +zero_stats (which is for users, not drivers) +- Bugfix: bitfury: Use proc_repr rather than incorrectly calculated chip_id +- Bugfix: bitfury: struct bitfury_device is already chip-specific +- bitfury: dynamic osc_6 bits +- bitfury: Improve frequency calculation - fixes occasional miscalculations as +well as makes it safer with multiple devices +- bitfury: Added frequency calculation +- tm_i2c: Corrected copyright +- Allow --set-device opt=val without a device specification to attempt setting +it on every device +- Bugfix: knc: Maintain queue_full for all cores, so they continue to queue work +even if the first is disabled +- bitfury: Allow setting osc6_bits up to 60 +- Bugfix: Set status to LIFE_DEAD2 when killing threads at shut off, to avoid +calling driver code +- Skip "testing stability" message at startup +- Try switching pools if for some reason we end up with only idle pools and have +ended up current_pool set to an idle one. +- Check a pool is stable for >5 mins before switching back to it. +- ManageTUI: Slash key performs processor selection by search +- nanofury: Populate dev_product and dev_serial +- mcp2210: Implement mcp2210_close +- Bugfix: mcp2210: hid_write needs a report id, especially on Windows +- mcp2210: Workaround some Windows snprintf not handling wide strings correctly +by simply copying character-per-character (only works for ASCII data) +- Bugfix: chroot: Check that chdir succeeds +- AUTHORS: Add pontus +- knc: Expose Voltage and DCDC Current to TUI Manage device +- knc: Expose Voltage and DCDC Current to RPC status +- knc: Store volt/current on knccore +- knc: Read voltage/current from DCDCs +- Bugfix: knc: Fix temperature readout of half-celcius +- Bugfix: Only define have_libusb if building with libusb support +- littlefury: Remove unused code +- bitfury: RPC procset: Ignore extra data (like newline) after numbers +- Add --set-device option to allow setting default procset commands +- README: Document hidapi dependency for NanoFury sticks +- AUTHORS: Include Vladimir Strinski for NanoFury code +- mcp2210: Set GPIO output mode atomically with their output values +- nanofury: Power off device when shutting down +- make-release: Include libhidapi-0.dll +- mcp2210: Port to Windows +- configure: Find hidapi.h for mcp2210 using pkg-config +- bitfury: Provide read/write access to osc6_bits from the Manage TUI +- nanofury: Reduce oscillator bits to 50 to stay within USB specs +- bitfury: If multiple integers differ after 4 tries, just go with the first so +we can start mining +- nanofury: Implement actual mining code +- nanofury: Turn off device after checkport +- nanofury: New driver; detect device +- mcp2210: Implement protocol required for NanoFury USB sticks +- mcp2210: Skeleton low-level driver for MCP2210 USB to SPI Master bridge +- ft232r: Use lowlevel interface for ft232r_open +- Abstract ft232r scan+probe interface into new generic lowlevel driver +interface +- configure: Error if knc driver is requested, but linux/i2c-dev.h is missing or +not from i2c-tools +- knc: Attempt to express core enable/disable to controller +- knc: Put knc_device on every processor device_data +- Refactor device disable/enable logic so that drv.thread_{disable,enable} +actually get called +- Bugfix: knc: Check that device actually has work queued, before trying to find +the most recent one +- knc: Read temperature sensors +- DevAPI: minerloop_queue: Run watchdog in device thread +- knc: Pass queue flush to device when its most recent job produces stale shares +- knc: Issue flush command at init +- Bugfix: knc: Perform le32toh on unknown-work nonces +- knc: Use independent device_id for works to enforce 15-bit size +- Bugfix: spi_emit_nop: Correct counter logic +- knc: Implement mining +- knc: Use FPGA i2c to identify present ASICs +- knc: Basic detection of boards on expected i2c buses +- DevAPI: generic_detect: Just use an enum for flags +- Use list of drivers/algos/options generated by configure in --help info +- miner.php correct sort gen field names largest to smallest +- api ... the code related to device elapsed +- api add device elapsed since hotplug devices Elapsed is less than cgminer Elapsed +- RPC: Include more info in per-device/processor status +- API add 'MHS %ds' to 'summary' +- Icarus remove unneeded opt_debug tests due to applog being a macro +- We should only yield once in cg_wunlock +- Provide a function to downgrade a cglock from a write lock to an intermediate +variant. +- Reset quotas on load balance for all pools at the same time to avoid running +out during selection and unintentionally dropping to fallback. +- Break out of select pool from a common point for appropriate debug messages +and to avoid further tests. +- Find the greatest common denominator in quotas and use the smallest number of +consecutive work items per pool in quota load balance mode to smooth hashrate +across pools with large quotas. Give excess quota to priority pool 0 instead of +pool 0. +- Add subdir-objects to automake options. +- Use the --failover-only flag to have special meaning in combination with +load-balance mode to distribute any unused quota back to pool 0 to maintain +ratios amongst other pools. +- Display quota and allow it to be modified via the pool menu. +- More README about quotas. +- Document quotas and new load-balance strategy. +- Add API commands and modify output to support pool quota displaying and +changing. +- Change message in status when using a balanced pool strategy to notify if +there's a stratum pool as well. +- Add quota support to configuration files. +- Rotate pools on all failures to set a pool in select_pool. +- Use quotas for load-balance pool strategy. +- Provide a mechanism for setting a pool quota to be used by load-balance. +- Change --socks-proxy option to default to SOCKS5 +- Cope with trailing slashes in stratum urls. +- Make extract_sockaddr set variables passed to it rather than pool struct +members. +- miner.php sort the mcast rigs so they are always in the same relative order +- miner.php allow sending the muticast message multiple times +- miner.php mcast ignore duplicate replies +- miner.php coding warning +- miner.php disable 'gen' by default +- miner.php allow formula generation of new fields +- miner.php add doctype +- miner.php remove incorrect echo +- miner.php optional error if not enough mcast rigs are found +- take_queued_work_bymidstate should use a write lock. +- API mcast add a description option with miner.php +- Skip dissecting opt->names in parse_config if it doesn't exist. +- ICA optional limit timing with short=N or long=N +- logging - applogsiz() for large messages +- Provide a funcion that looks up queued work by midstate and then removes it +from the device hash database. +- Wait until all pools are done testing before giving up, regardless of how long +they take to fail +- AUTHORS: Add Ricardo Iván Vieitez Parra and Paul Wouters +- Bugfix: Check that setgid succeeds +- When using --chroot, chdir to the new root +- Bugfix: Add missing drivers to --help list +- Bugfix: Zero stats: cgpu->diff_stale +- fpgautils: serial_close: Explicitly release advisory lock before closing, in +case fd has been inherited by a process forked by system() +- Use serial_close to pair with every serial_open +- Workaround bug in Plibc by resetting locale to "C" at startup +- Bugfix: bitfury: Check for necessity of linux/i2c.h so build succeeds with +i2c-tools's userspace linux/i2c-dev.h +- bitforce: Workaround bugs in current firmware for the Chili +- Bugfix: DevAPI: Reduce race-collision delay to 1ms so thread_shutdown actually +gets called before threads are killed forcefully +- Bugfix: configure: Use AC_SYS_LARGEFILE to ensure nonce/share log files can +safely grow bigger than 2 GB +- Bugfix: Correct argument type for --submit-threads option +- littlefury: Workaround Xcode bug initialising fields in anonymous unions +- Bugfix: write_config: Make intensity list writing more readable, and avoid +extraneous argument in dynamic intensity case +- DevAPI: Trigger mt_disable_start after init, if a device is disabled before +minerloop starts +- icarus: Skip sending new work if entering DEV_RECOVER* modes +- icarus: When disabling, close device fd and stop sending new work +- RPC: Use get_api_extra_device_status for full-device status, for devices with +only a single processor + + +BFGMiner Version 3.3.0 - October 11, 2013 + +- openwrt: Optional libevent support +- RPC: Add missing drivers to Device Code +- bigpic_process_results: Cleanup +- RPC: Use procs count for device summaries, rather than iterating over linked +list (which may span multiple devices) +- Bugfix: Use bfg_waddstr for cg_[mv]wprintw so special characters get +interpreted properly +- Bugfix: bitfury: Clear force_reinit flag after reinit +- Bugfix: Use base unit for zero, and only if all values are zero +- RPC: Always build pga* and proc* methods +- Bugfix: icarus: Check for valid fd before all usage +- Bugfix: Stratum initiate: Clear json var after freeing it, to avoid a +potential double-free if retry fails before new JSON is parsed +- Bugfix: Correct --log-file error message +- Cleanly fall back to other micro- prefix symbols if locale doesn't support the +preferred one(s) +- Bugfix: bfg_waddstr: Missing break after selecting degrees symbol +- Silence warning about (never really) uninitalised variable use in notifystatus +- RPC: Complete split between devs/pga* and proc* methods +- RPC: Internal restructuring to support device-wide view +- RPC: Remove devdetail method, and rework newer devdetails to use its code +- configure: Advise running ldconfig when detected and probably necessary +- configure: Simplify final information summary +- Bugfix: configure: Disable httpsrv/libevent if not available +- README: Mention free GPU mining dependencies +- Write config: Avoid writing default temperature settings +- bitforce: Set default cutoff temperature to 85C for SC-class devices +- When shutting down, don't wait for mining threads any longer after the 1 +second sleep +- bitfury: Silence warning about (never possible) uninitialised variable use +- bigpic: Handle write failures +- json_rpc_call_completed: Silence incorrect type cast warning +- icarus: Silence warning about (never really) uninitalised variable use in +icarus_scanhash +- fpgautils: Check for fgets error +- Silence warning about (never really) uninitalised variable use in +multi_format_unit +- ft232r: Silence warning about (never really) uninitalised variable use +- Silence unused result warnings for notifier_{read,wake} +- Log a warning if --cmd-* returns a non-zero exit code +- configure: Update bigpic driver dependency on bitfury code +- metabank: Initialise --temp-cutoff to 50C +- README.ASIC: Document special care needed for some bitfury-based miners +- Bugfix: bitfury: Correct results from RPC pgaset +- bitfury: Move Slot and fasync RPC info to details instead of status +- bitfury: Include chip fasync in RPC status +- bfsb: Split up processors among a separate device per board +- Bugfix: bitfury: Copy rxbufs to stack in case we need to do SPI communication +in the meantime +- bfsb: Merge bfsb_detect_chips into bfsb_autodetect (unchanged) +- bfsb/metabank: Allow pgaset to change osc6_bits and SPI baud rate +- bitfury: Fix code indentation +- bitfury: bitfury_init_oldbuf: Optimise during runtime +- metabank: Remove unused variables +- bitfury: Send a work with lots of nonces to help cold-started bitfurys fill a +static buffer +- Bugfix: configure: Show --enable-bfsb/metabank in help, since they are +disabled by default +- metabank: Reduce i2c banking to only when necessary +- bfsb: Only build spi_bfsb_select_bank if bfsb driver is being compiled +- bitfury: Reorganize polling to hit chips sequentially, so SPI traffic can be +minimised +- bitfury: spi_emit_data: Return address read data will be located at after txrx +- bitfury: After 8 bad nonces in a sample period, reinit immediately rather than +waiting for the remaining up-to-0x38 +- bitfury: Reinitialise chips if their active nonce stops changing +- bitfury: Recalibrate immediately when we know we need it +- bitfury: Reset chips if more than 8 hw errors are found in a 0x40 result +sample period +- bitfury: If previous nonce mismatch persists, try recalibrating oldbuf +- bfsb: Shutdown chip when disabling +- bfsb: Expose Clock Bits and Slot to RPC +- configure: Simplify dynclock necessity detection +- configure: Tie libudev usage to fpgautils +- configure: Simplify fpgautils necessity detection +- DevAPI: add_cgpu_slave for more elegant multi-device threads +- Use procs count for device summaries, rather than iterating over linked list +(which may span multiple devices) +- metabank: Split up processors among a separate device per board +- metabank: Merge metabank_detect_chips into metabank_autodetect (unchanged) +- Removed temperature output from metabank_api_extra_device_status(). +- Modified code to store temperature at cgpu->temp for metabank devices. +- bitfury: Added get_api_extra_device_status for 'devs' request in metabank +driver: Slot, Clock Bits, Temperature, Voltage. +- minerloop_async: Run watchdog code within actual device thread +- bitfury: Remove unused libbitfury_readHashData +- Bugfix: DevAPI: Don't call job_process_results when there was no previous job +- bigpic: Convert to async minerloop +- bitfury: Port to Windows +- bigpic: Use bitfury_fudge_nonce +- Use common bitfury_decnonce for all bitfury-based devices +- Rename bf1 driver to bigpic, as the same device has other brands too +- bf1: Clean up log messages +- bf1: Reduce loglevel of debug messages +- Bugfix: bf1: Add missing header to Makefile.am, and fix .dname/.name +- Bugfix: bf1: Fix warnings +- BF1 driver modified to work under Windows -> packing of structs isn't working +with Windows +- Corrected hash rate estimation for BF1. Only 756 out of 1024 nonces are +scanned. +- Cleaning up the bf1 driver code +- BF1 driver working +- Bitfury BF1 source files added +- bfsb: modified to use LukeJr:'s new code +- configure: Reorder output +- configure: Allow to build *fury drivers only +- bitfury: Turn commented debug stuff into #ifdef BITFURY_SENDHASHDATA_DEBUG +- bitfury: Implement queue_full to ensure all processors have a work ready +before scanwork +- bfsb: set api speed to 625khz +- initial support for bitfurystrikesback boards +- bitfury: LINE_LEN instead of 2048 +- bitfury: 4Mhz SPI by default +- bitfury: double SPI polling +- bitfury: +Strange Counter -printf Counter +- bitfury: tuning of parameters; fixed cycles calculation +- bitfury: Move clock increase from common code to metabank driver init +- bitfury: Add driver-bitfury.h for shared function declarations +- bitfury: Do debug logging of read data before rotation +- bitfury: Decode nonce array sooner to make debugging easier +- bitfury: Check that the previous nonce still matches, to detect response +corruption +- bitfury: Workaround corruption by looking for matches rather than changes +- bitfury: Rewrite using async minerloop (currently only setup on metabank +driver) +- bitfury: Fix memory issues +- littlefury: Turn off chips when exiting +- littlefury: Adapt to 16-bit payload size (protocol change) +- Bugfix: littlefury: Fix bitfury_do_packet +- bitfury: Report bad nonces properly +- bitfury: Unify common nonce fudging code +- Bugfix: bitfury: Chips only scan 0xbd000000 nonces per work +- bitfury: Fix logging to use applog +- bitfury: Split driver into bitfury_gpio (bare GPIO) and metabank (i2c banked +GPIO) +- littlefury: Use bitfury driver scanwork +- bitfury: Eliminate more static variables +- bitfury: Treat each chip as its own processor +- bitfury: Resolve devices[chip] only once per chip +- bitfury: Move second_run logic back to libbitfury +- bitfury: Loop over chips once during scanwork +- bitfury: Abstract hashes_done2 which keeps track of time deltas per thr on its +own +- littlefury: Need to set tv_morework +- bitfury: Abstract out payload_to_atrvec +- littlefury: Log read return value when unexpected +- bitfury: Eliminate non-const global variables +- littlefury: Safeguard on job switching +- Bugfix: littlefury: Keep reading until error, EOF, or buffer filled +- littlefury: Log devproto of incomplete reads +- Enable littlefury detection +- Bugfix: configure: Enable bitfury by default properly +- bitfury: Require explicit -S bitfury:auto to probe GPIO-based SPI +- bitfury: Move i2c slot handling to metabank-specific driver code +- littlefury: Initial driver for BitCentury's USB miner +- bitfury: Split actual chip detection into simple function +- Bugfix: bitfury: Fix driver "name" to be correct length +- bitfury: Abstract SPI interface +- Bugfix: bitfury: Fix more warnings +- Bugfix: bitfury: Fix warnings +- bitfury: Intercept and use applog for perror calls +- Bugfix: bitfury: Handle SPI init failure cleanly +- bitfury: major intermediate update +- bitfury: added chip series detection; multiple chip mining +- Bitfury ASIC initial support +- DynClk: Improve commented documentation +- Replace Utility with (expected) Income calculated by actual shares submitted +in 100% PPS value +- format_unit3: BTC formatting with 2 decimal place digits +- format_unit3: Support for nano- and pico- sizes +- format_unit3: Use an enum for float-precision parameter +- format_unit2: Support milli- and micro- unit prefixes +- opencl: Disable by default if other devices are found; to enable, use -S +opencl:auto +- write_config: Save request-diff option +- Stratum: Clear unused extranonce2 space +- Don't even show 'Attempting to restart' for devices that don't support it +- Workaround bug in PDCurses wresize +- Bugfix: Include config.h in sha2.c first +- make-release: Include libevent-2-0-5.dll in Windows packages +- README: Document dependency on libevent +- README: Document new --chroot-dir and --setuid options +- Bugfix: Use correct configure define for chroot +- Remove --disable-chroot build option: always compile --chroot-dir if supported +- Bugfix: Use correct configure define for pwd.h +- Improvements on code +- Update miner.c +- Added basic chroot support, added option to configure.ac. +- Updated miner.c +- Added basic chroot support +- Replace u-hashrate with nonce-based hashrate adjusted for rejects/stales +- SSM: Windows port +- SSM: Allow configuring stratum port via --stratum-port option and RPC +setconfig +- SSM: Implement mining.hashes_done extension +- Proxy: Catch invalid usernames and error +- SSM: Report hashes done based on share submissions +- SSM: Include current time in job ids to avoid false hardware errors due to job +id reuse +- SSM: If no notify is currently set, try to set it before refusing a subscribe +- SSM: Prune old jobs after expiry +- SSM: Use pool data read lock when subdividing notify +- SSM: Gracefully fail when upstream stratum notify cannot be subdivided +- SSM: Gracefully fail when upstream pool is not stratum (by closing subscribed +clients, and refusing to subscribe new ones) +- SSM: Properly fail cleanly when maximum clients are connected +- SSM: Clean up stratumsrv_job when pruning it +- SSM: Avoid responding to notifications, and give an error for unknown methods +- SSM: Propagate work updates to clients +- Mostly functional stratum proxy driver +- Stratum: Split actual work generation away from the current pool data +- Bugfix: Stratum: Dereference pool swork coinbase buffer inside data lock +- SGW: Split proxy code out from driver-getwork into driver-proxy +- Bugfix: miner.php: Check $dototal[$name] is set before comparing its value +- Bugfix: RPC: Use bad_nonces in Hardware% instead of generic hw_errors +- Bugfix: RPC: Handle LIFE_DEAD2 case +- Make failure to open sharelog or noncelog abort startup +- Nonce logging option --noncelog to simply store every nonce and its info +- Abstract --sharelog option parsing + + +BFGMiner Version 3.2.1 - September 19, 2013 + +- Only show long-poll message in pool summary if it's not using stratum. +- README.ASIC: Clarify syntax of --scan-serial usage for USB Erupters +- Bugfix: RPC: Defer allocation of apisock until after we check for --api-listen +- make-release: Only try to include libmicrohttpd if bfgminer.exe depends on it +- Bugfix: make-release: Include libplibc-1.dll if available +- SGW: For Windows builds, include winsock2.h instead of POSIX networking +headers +- configure: Display getwork proxy server support in summary +- Bugfix: SGW: Pass actual cgpu_info to prune_worklog_thread instead of silently +casting one from getwork_client +- Bugfix: Get total_staged with lock for TS stat, before getting console lock +- Bugfix: bitforce: Correct fanmode RPC help +- bitforce: Hide fan control when disabled in firmware +- Bugfix: bitforce: Correct fanspeed TUI setting +- Bugfix: logging: Allow up to 4 KB for log lines +- Bugfix: icarus: Ensure last2_work exists before trying to check nonces fit it +- README.OpenWrt: Include serialusb drivers +- README: Include OpenWrt serialusb driver package names +- Bugfix: Initialise notifier (as invalid) for no-thread devices (SGW) +- Bugfix: Free temporary kernel path copy when writing config file +- Bugfix: Put kernel path on the (main) stack after initialisation from +commandline/config, to avoid appending an argv or jansson string +- Bugfix: Always allow startup with curses enabled (since the user can use +Manage devices to add new ones, and display Ctrl-C for text-only quit help +- Bugfix: Ignore/reject libmicrohttpd before 0.9.5, which introduced symbols we +need +- README: Elaborate on format of BW +- Bugfix: Try to initialise libusb later, so any mutexes applog might need are +initialised +- Bugfix: Implicitly initialise timer_set_now when it is first called +- util: Eliminate unsafe const-removing casts +- configure: Cleanup CFLAGS/LDFLAGS display +- Show RT_LIBS in ./configure output. + + +BFGMiner Version 3.2.0 - August 29, 2013 +- cpu: sse2_64: Rename sha256_init to sha256_init_sse2 to avoid conflict with +new sha2.c +- httpsrv: Some older versions of libmicrohttpd need stdint.h included first +- make-release: Include libmicrohttpd-10.dll if it exists +- Fixes column alignment in decimal fields. Workaround for printf rounding up +when formatting decimals into limited width. +- New hidden --unittest option. No longer runs unit tests at startup by default, +for faster startup. Added unit test for width printing of decimal numbers. +- Bugfix: configure: More fixing BSD sed syntax for curses header search +- Bugfix: configure: More fixing BSD sed syntax for libusb header search +- README: Update solo mining docs +- erupter: Continue searching a job until the end, even if an earlier result is +found +- icarus: Do hwerror-triggered reopen before sending the next job the first +time, to avoid having to resend it later +- icarus: Avoid sending a new job if the nonce found was for one before the +current job anyway +- icarus: Double-buffer work to solve nonces found before work change takes +effect +- icarus: Abstract nonce processing +- Bugfix: icarus: Avoid trying to submit 0 on comms error +- icarus: Skip unnecessary nonce memcpy +- icarus: Make state->last_work a pointer and store it on the heap +- miner.php fix missing global +- Bugfix: erupter: After identify, skip starting work if next scanhash is +already decided to be a "first run" (eg, device errors) +- Bugfix: erupter: Fix identify following hw error +- Bugfix: icarus: Don't try to send work if device open failed +- Debug log when zeroing stats +- Upgrade libblkmaker to 0.3.2 +- Bugfix: GBT: Advertise coinbasevalue capability +- Bugfix: Always compile add_serial now that it's somewhat generic +- icarus: Avoid sending a new job if the nonce found was for one before the +current job anyway +- icarus: Double-buffer work to solve nonces found before work change takes +effect +- icarus: Abstract nonce processing +- Bugfix: icarus: Avoid trying to submit 0 on comms error +- icarus: Skip unnecessary nonce memcpy +- icarus: Make state->last_work a pointer and store it on the heap +- README.RPC: Remove usbstats mention +- README: Add FAQ regarding cgminer messing up drivers +- README.RPC: Fix miner name +- README.RPC: Correct to mention other supported devices for pgaidentify +- api.c fix mcast debug message bug +- README.RPC: break all lines at most 80 characters +- Update the API Multicast documentation +- miner.php implement API Multicast handling to automatically find your local +net miners +- Bugfix: RPC: Fix log format types in io_flush +- Set RT_LIBS correctly from autoconf detection +- Explicitly check for clock_nanosleep and only use it when available +- Further integrate cgsleep API into BFGMiner's timer system, so clock_nanosleep +is only used on platforms with CLOCK_MONOTONIC +- Convert cgtimer_t to struct timeval +- Bugfix: Fix BSD sed syntax for curses header search +- Bugfix: configure: Really fix BSD sed syntax for libusb header search +- README.RPC: Mention multicast detection +- README: Include --mcast-* options in usage +- Use ccan's standard char* set/show functions for --api-mcast-{addr,code} +- Bugfix: RPC: Use the same mcast code in reply, and log it correctly +- API mcast only reply to remote IP's that are allowed access +- Initial API Multicast response v0.1 to find cgminer APIs +- Check for cnx_needed on each loop through wait_lp_current. +- Return positive for cnx_needed when no_work is true. +- Add no_work bool to set when we are in an underrun situation +- Reorder support names alphabetically. +- We don't want to continue into the hash_pop function if the getq is frozen. +- Carve out the unused portions of sha2 implementation. +- Import Aaron D. Gifford's fast sha256 implementation. +- Use cloned work when finding avalon results since another thread can discard +the work item while it's in use. +- Provide a variant of find_work_bymidstate that returns a clone of the found +work. +- Use timespecs on windows as cgtimer_t to capitalise on the higher resolution +clock changes. +- Abstract out the conversion of system time to an lldiv_t in decimicroseconds. +- Use our own gettimeofday implementation on windows for it to be consistent +across ming builds and higher resolution. +- Provide cgtimer_sub helper functions. +- Provide cgtimer_to_ms helper functions. +- Rename cgsleep_prepare_r as cgtimer_time to get time in cgtimer_t format and +call cgsleep_prepare_r as a macro for cgtimer_time +- TimeBeginPeriod and TimeEndPeriod do not add significant overhead when run the +entire time for cgminer so avoid trying to maintain balanced numbers of them for +specific time calls to simplify code. +- Replace all references to the old n*sleep functions with the equivalent +cgsleep_*s replacements. +- timeGetTime uses huge resources on windows so revert to using timevals for its +implementation of cgtimer_t +- Quotient/remainder error in ms division. +- Provide cgtimer_to_timeval helper functions. +- Provide a timeval_to_cgtime helper function to reuse values. +- Simplify cgsleep code for windows by using a typedef for cgtimer_t that +resolves to clock resolution, using that internally. +- On windows use the higher accuracy timegettime function to really get 1ms +clock and timer accuracy. +- Fix missed endtimeperiod in overrun timer on windows. +- Make cgsleep_us_r take an int64_t for us. +- Make the cgsleep functions build on windows. +- Set high resolution timing on windows within the cgsleep functions. +- Provide reentrant versions of cgsleep functions to allow start time to be set +separately from the beginning of the actual sleep, allowing scheduling delays to +be counted in the sleep. +- Make the nmsleep and nusleep functions use the new cgsleep functions internally +till functions are migrated to the new cgsleep API. +- Add a ms_to_timespec helper function, and create a cgsleep_ms function that +uses absolute timers with clock_nanosleep to avoid overruns. +- Add rt lib linkage to enable use of clock_nanosleep functions with older +glibc. +- Add a timeraddspec helper function. +- Provide a us_to_timespec helper function. +- Provide a us_to_timeval helper function. +- Add helper functions to convert timespec to timeval and vice versa. +- Bugfix: SGW: Discard work from log only by expiry, so post-startup hardware +errors are truly only hardware errors +- bitforce: Make voltages available to RPC +- bitforce: Save voltages as array of longs internally +- Bugfix: Clear device bad nonces when zeroing stats +- cpu & opencl: Defer RUNONCE to actual autodetection, so they can be added once +after startup +- Bugfix: Avoid crash activating [M]anage devices with no currently defined +devices +- TUI: Support for adding new devices using the plus key from [M]anage devices +- Bugfix: Use add_serial function for scan_serial, so that "all" keyword works +correctly +- SGW: Add support for new X-Hashes-Done header to allow devices to more +accurately report their work +- SGW: Add X-Mining-Identifier header to inform devices what they are +represented by in BFGMiner +- SGW: Use JSON for 401 response; add Server HTTP header +- AUTHORS: Add contributor Josh Lehan +- Changed comparison constants to allow for floating-point rounding +- Install README.ASIC for Block Erupter related drivers as well as Avalon +- make-release: Windows users don't need README.Debian +- README.OpenWrt: Import from BFGMiner downloads +- Silence Windows warning about send data signedness +- Fix block info +- API/miner.php add some % fields +- Don't yield on grabbing the read lock variant of cglocks. +- util.c expand quit to show file/func/line +- We should be using a cg_wlock initially in generating stratum work before +downgrading the lock. +- Add the ability to downgrade a write variant of the cglocks. +- Yield after releasing a lock in case we are on a device with limited CPU +resources. +- Fix --scrypt being required before scrypt intensities on command line or not +working at all via config files. +- Limit intensity range according to whether scrypt is in use or not. +- Do not allow benchmark mode to be used with scrypt. +- miner.php format Best Share +- README.ASIC block erupter USB brief +- Check for negative wait time in socket_full. +- Adjust socket wait timeout in recv_line according to how long we've already +waited to avoid a 60 second wait dropping to 1 second due to a blocked socket. +- force type checking on curses +- logging - size check sprintf +- Only use length-counted variants of format_unit and percentf +- Implement snprintf-like versions of format_unit and percentf +- miner - size check all sprintf +- size check get_datestamp/get_timestamp and remove unused cgpu->init +- make all statline overflow safe +- Convert the decay_time function into one that truly creates an exponentially +decaying average over opt_log_interval. +- GPU fan rpm display 9999 when it overflows +- Change mode on python file. +- Only update hashmeter if we have done hashes or haven't updated longer than +the log interval, fixing a us/ms error. +- README.ASIC: Document usage with Block Erupter Blades +- README: Add mention of libmicrohttpd to dependencies +- SGW: Include hash1 in work +- SGW: Include application/json Content-Type header +- Fix build without libmicrohttpd +- Allow startup to proceed with no devices, as long as RPC or HTTP are listening +- SGW: Refuse to issue new work to disabled devices +- SGW: Respond with stale rejection if share is known to be immediately stale +- Expose HTTP getwork username in Manage TUI and devdetails RPC +- Add --cmd-idle notification command for REST/WAIT conditions +- bfgminer-rpc: Accept unlimited size replies +- api-example.py: Accept unlimited size replies +- RPC: Rewrite io_data to cleanly handle unlimited sized responses +- Configure options to build --without-libmicrohttpd support +- RPC: setconfig can now change http-port (enabling or disabling the http +service included) +- Embedded HTTP server to handle getwork-based mining devices +- inc_hw_errors2 function can handle a bad nonce without a known work +- Split up scan_serial function to enable internally adding ad-hoc cgpu +- Helper functions bfg_json_obj_string and share __json_array_string +- bytes_t: Add bytes_shift and bytes_nullterminate +- Fix configure help for --without-sensors +- README: Document --with-system-libblkmaker +- Bugfix: Use BSD-friendly sed syntax for libusb header search +- Bugfix: Handle bitstreams properly +- Bugfix: Skip search for addwstr since it breaks --with-curses=preference +- Bugfix: configure: Find correct curses include path without *-config +- README.FPGA: Further clarify ZTEX setup +- Display a friendly error directing to README.FPGA when bitstream cannot be +loaded +- Remove bitstreams from BFGMiner distribution entirely, and include pointers +where to find them in README.FPGA +- ztex: Use load_bitstream_bytes for .bin files +- fpgautils: load_bitstream_bytes support for Intel HEX format (.ihx) files +- Add missing 16-bit byteswap macros +- fpgautils: load_bitstream_bytes function to load a bitstream into a bytes_t +- bytes_t functions: bytes_init, bytes_append, bytes_reset +- Look for bitstreams in /usr/share/bitstreams +- Disable Unicode support by default (use --unicode to enable) +- make-release: Skip stripping debug info from Windows EXEs, for now +- Bugfix: Ensure work variable is assigned before checking its thr_id +- Bugfix: notifier_init (Windows): setsockopt needs an int for SO_REUSEADDR +- Bugfix: Avoid turning totals red just because a processor is idle +- Enable notifications for sick/dead with --cmd-sick and --cmd-dead options that +execute commands when the event occurs +- RPC: Add cpu enable/disable/restart +- windows-build: Update to use libpdcursesw.dll +- Ensure socket error messages are used for socket errors on Windows +- fpgautils: Attempt to use Linux advisory locks on serial devices +- Bugfix: README: --temp-cutoff sets the maximum temperature before cutoff, not +temperature that triggers cutoff +- Bugfix: Avoid incrementing dev_thermal_cutoff_count when just updating +timestamp on status +- Detect curses support for wide characters during configure +- configure: Check for more variants of curses library names +- Bugfix: ztex: Avoid trying to format non-libusb error with libusb error name +- Bugfix: Avoid trying to assign const use_unicode variable with --no-unicode +option +- Remove long-unused opt_time variable +- RPC: Avoid exposing Coinbase-Sig when it isn't supported +- Bugfix: Fix build with libblkmaker < 0.2 +- Attempt stratum mining.suggest_target before mining.subscribe, if +--request-diff is used +- Retry stratum if initiation fails for any reason after we have sent something +(assuming there is more older variants we can try) +- Bugfix: Restore delay for authorization on stratum mining.get_transactions +- Bugfix: Fix TUI-only build +- bitforce: Extend pgaset _cmd to variable-length commands +- Bugfix: Use red for total processor count +- bitforce: Undocumented _cmd1 pgaset for experimenting with firmware +- Bugfix: curses: use_default_colors() when possible +- Bugfix: Calculate scrolling range with new cursor lines +- Bugfix: Ensure use_unicode and have_unicode_degrees constants are defined for +curses-less builds +- Bugfix: Replace block_timeval with (time_t) block_time +- README: Update for --no-unicode option + + +BFGMiner Version 3.1.4 - August 2, 2013 +- Windows: Rebuild pdcurses with UTF-8 and wide character support +- Bugfix: Avoid using wide curses symbols/macros when USE_UNICODE is not defined +- Unicode: Use line drawing in TUI Help +- Use bfg_waddstr even with Unicode disabled, since it's needed for red +highlight +- Colour bad conditions in red +- Unicode: Cross-tee intersecting lines +- Unicode: Use WACS_VLINE for vertical lines +- Unicode: If degrees symbol is available, add it to temperatures +- Unicode: bfg_waddstr wrapper to handle non-ASCII characters, currently used +only by logging and statlines +- Unicode: Use WACS_HLINE for horizontal lines +- Add framework for using Unicode in TUI (can be disabled with --no-unicode) +- Avoid using potentially locale-dependent ctype functions in locale-independent +contexts +- Refactor temperature in TUI statlines to share code nicer +- Bugfix: avalon: Fix applog formatting +- Bugfix: Align totals columns in per-processor view +- Bugfix: Fix curses-less build +- configure: Workaround buggy autoconf versions +- Bugfix: erupter: Include headers in order necessary for Windows +- Bugfix: Reimplement get_intrange using strtol instead of sscanf (which is +broken on Windows) +- Bugfix: get_intrange: Check for extra garbage at the end, only after we know +we have an end-position +- Bugfix: Fix Enter key in TUI on Windows +- erupter: Split identify-handling logic into handle_identify function +- Bugfix: erupter: Ensure identify is handled during no-once or firstrun +- erupter: After identify, check if a work restart is needed immediately +- erupter: Implement identify function by pausing hashing for 3 seconds +- Bugfix: icarus: Remember firstrun state in case it gets changed for the next +run +- icarus: Move actual dynclock updates to icarus_job_start +- icarus: Split out icarus_job_prepare, and rename icarus_job_start +- Bugfix: ZeroStats: Reset column widths to 1 +- miner.php: Include max temperature in device totals line +- Bugfix: Stratum Fix debug logging of initial mining.subscribe command +- Bugfix: Call pool_set_opaque from work_decode, so block content hiding/ +providing messages work for getwork/GBT +- Split block contents hiding/providing notices out from stratum code +- Add test suite for get_intrange +- Bugfix: Check for error conditions in get_intrange to not have weird --device +behaviour when bad values are provided +- Bugfix: erupter: Take advantage of detectone_meta_info to handle Emerald +autodetection +- TUI Help describing the various status fields (contributed by midnightmagic) +- Bugfix: ManageTUI: Allow 'I' key to be used by devices not supporting identify +- Bugfix: Prefer Sapphire over Emerald for -S erupter:* +- Bugfix: Clear total_bad_nonces when zeroing statistics +- Bugfix: modminer: Since we are not searching iManuf string for needles, only +look for "ModMiner" +- Bugfix: sysfs autodetect: Recurse into tty/ subdirectory (necessary for +CDC/ACM ttys) +- sysfs autodetect: Split tty* directory search into new _sysfs_find_tty +function +- modminer: Reduce default clock to 190 MHz +- README: Update driver info to include Erupter driver +- README: FAQ about scrypt and difficulty +- Include count of working devices/processors in totals statline +- Format totals statline the same way as individual device/processor statlines +- Rearrange TUI a bit, including menu at the top (+1 log line) and hashrate +total closer to device summaries +- Bugfix: setup_stratum_curl: Need to release stratum lock on connection failure +too +- Bugfix: Avoid unnecessary locks inside curses_print_status, which is called +with the console lock held +- Bugfix: setup_stratum_curl: Hold stratum lock until connection completes, to +avoid potential races +- Bugfix: stratum_works: If stratum is already active, it works (avoid trying to +initialise it again) +- Replace hashrate_to_bufstr/ti_hashrate_bufstr with format_unit/ +multi_format_unit_array +- New multi_format_unit_array to fill multiple buffers instead of building a +delimited string +- multi_format_unit: Skip recounting length of fixed-length strings +- Shrink status line to fit in 80 columns +- Add network bandwidth rate to TUI +- New multi_format_unit variadic macro to handle formatting multiple numbers at +once +- format_unit: Option to choose 3-digit integer display vs 5-character floating- +point display +- Optimization: format_unit: Handle number first, to avoid having to restore +suffix later +- Generalise hashrate_pick_unit/hashrate_to_bufstr into pick_unit/format_unit +- Extend hashrate_pick_unit/hashrate_to_bufstr to handle sub-kilo units +- Split total_bytes_xfer to total_bytes_rcvd and total_bytes_sent +- Bugfix: _decode_udev_enc_dup: Allocate enough space for full string +- Bugfix: Never use waddstr for logwin, since it would bypass special newline +handling +- Bugfix: bitforce: Set kname on chip processors +- bitforce: Include voltages in Manage device TUI +- Defer newlines going to curses logwin, to avoid a useless blank line at the +bottom of the window +- Ensure printing to logwin always goes through _wlog +- Remove blank line above log window +- bitforce: Identify parallel queue protocol distinctly from mere bulk queue +- ManageTUI: Include kernel name, when available +- Stratum: Roll ntime as we generate work +- Stratum: Make swork.ntime native-endian +- Stratum: Treat ntime as uint32_t (as it should be), still always big endian +- Debuglog ManageTUI actions/responses +- ManageTUI: Add generic Identify support +- Bugfix: Move serial_detect* and open_bitstream to DevAPI code so CPU/OpenCL +can build properly without fpgautils +- Short-circuit logging sooner in quiet mode +- Write to both stderr and console within same console lock "session" +- Bugfix: Also hold the console lock when writing to stderr +- Use common console locking function for stdout in logging.c +- Move console lock and unlock functions (which also handle thread cancelstate) +to miner.h +- Bugfix: bitforce: Only try to clear queues of SC devices, since FPGA MR boards +interpret ZQX/ZOX differently +- Timer-based gettimeofday substitute for systems with poor time-of-day clocks +(Windows) +- Use clock_gettime(CLOCK_MONOTONIC) for timers when available +- Use QueryPerformanceCounter for timers on Windows +- Generic refactoring for timer_set_now +- Replace all remaining uses of gettimeofday for timers, with timer_set_now (aka +cgtime) +- Don't mix timers with timestamps (visual only) +- Always use struct timeval for timers, and don't mix timers with timestamps +(functional only) +- get_datestamp: Change timeval parameter to time_t, and implement +get_now_datestamp for common "current time" use case +- Use get_datestamp for (non-microsecond) log timestamps +- Bugfix: ztex: Allocate final processor names on the heap, so they survive when +the stack for ztex_prepare is gone +- Bugfix: ztex: Copy serial number to device "name" before cloning it for other +processors +- Bugfix: x6500: Use cgpu->temp directly since there is only one sensor per +processor +- Bugfix: Actually show the highest temperature, not just calculate it +- x6500: Allow changing clock speed from TUI Manage device +- x6500: Port pgaset clock from modminer driver at +66d2a3ab072fcdbc3c7ed41a97f265afa917bbee +- modminer: Allow changing clock speed from TUI Manage device +- bitforce: Flush job and result queues at startup to avoid unnecessary warnings +- x6500: Reduce default clock to 190 MHz +- Bugfix: fpgautils: Close libusb handle after copying USB strings +- use BSD sed syntax to generate iospeed_local.h + + +BFGMiner Version 3.1.3 - July 11, 2013 +- Bugfix: Reset staged_full flag when discarding (stale) popped work, or +increasing the queue minimum +- Bugfix: Only trigger staged work underrun if a mining thread was actually +waiting for it (and do so sooner, before it has the work made) +- bytes_cpy: avoid malloc and memcpy when size is zero +- fix infinite loop in bytes_cpy when size is zero +- Bugfix: Generate iospeeds_local.h based on termios.h defines, and only try to +use POSIX standard if that fails + + +BFGMiner Version 3.1.2 - July 8, 2013 +- When not compiling with optimizations, initialize unused nonce2 space to avoid +warnings from memory checking tools +- TUI Manage devices: Support PgUp/PgDn keys to skip over processors within the +same device +- Bugfix: bitforce: Prefer 2nd temperature if higher than 1st +- When displaying device summary statlines, use the highest temperature reported +by any processor +- Stratum: Fix nonce2 sizes greater than 4 and (on big-endian) smaller than 4 +- bitforce: Manage TUI: Display both temperatures (if two), and enable changing +fan speed +- opencl: Add fan speed to Manage device TUI now that it's been removed from +statline +- DevAPI: Remove old statline APIs entirely, and add new override_statline_temp +(used by modminer/x6500 for upload %) +- README: Update statlines +- TUI: Replace DevAPI statline_before with a predefined temperature column to +free up statline space +- Refactor and simplify bin2hex to speed up and avoid unnecessary heap use +- stratum: Refactor work generation to do hex2bin conversions once, rather than +every single header generated +- Implement bytes_t for generic binary data storage (including smart realloc- +based resize) +- Bugfix: fpgautils: Only try to change baud rate when requested +- x6500: Provide manuf/product/serial to cgpu interface +- ztex: Provide manuf/product/serial to cgpu interface +- erupter: Use baud 115200 by default +- List valid baud rates once in iospeeds.h and standardize conversions +- TUI: Display device manufacturer/product/serial in Manage device screen, when +available +- DevAPI: Store manufacturer/product/serial for each device +- fpgautils: detectone_meta_info to provide metainformation (manufacturer, +product, serial) on devices to detectone functions +- Bugfix: fpgautils: Close product string file from sysfs (autodetect) +- erupter: New icarus-based driver to handle autodetection of Block Erupter +devices +- Add --log-file option which redirects stderr to a file, but valid anywhere in +the commandline or config file +- Detect staged work underruns and increase queue to avoid them +- Rewrite hex2bin to perform much faster (reduces minirig CPU usage by more than +half!) +- README: Add condensed list of dependencies +- Enable "maintainer mode" by default +- Bugfix: opencl: TUI manage: "Change settings" must not be compiled in with +no-ADL builds +- Bugfix: Detect whether the linker accepts -zorigin before attempting to use it +- opencl: ADL: ADL_Adapter_ID_Get fails with newer drivers, so tolerate its +failure best we can +- opencl: Don't try to use BFI_INT patching with APP-SDK newer than 1084 +(Catalyst 13.1), since it doesn't work +- fpgautils: Elaborate that bitstream open failures are probably due to missing +bitstream package +- fpgautils: s/firmware/bitstream/ +- Bugfix: Cleanup handling of complete device/driver failure +- Deprecate -C (enable CPU) and -G (disable GPU) options, now that -S +drv:[no]auto can be used for the same purposes +- Bugfix: Since at least one of unix (or __APPLE__) or WIN32 is required by +util.h, make sure unix is defined if WIN32 is not +- Bugfix: Set ELF rpath for bundled libblkmaker to use $ORIGIN so it can be run +from other directories +- Bugfix: Cleanup needs to happen before printing the final quit message, or it +gets lost in TUI mode +- Bugfix: fpgautils: Initialize my_dev_t instances with null bytes, to ensure +random unused data cannot influence hash keys +- opencl: ManageTUI: Clear log cleanly for changing settings +- Remove "GPU management" TUI entirely +- opencl: Use new "Manage device" interface to do everything "GPU management" +used to be used for +- DevAPI: Add interface for drivers to define custom "Manage device" options +- DevAPI: New function called to display additional processor information for +"Manage devices" +- TUI: Add enable/disable commands to device management +- TUI: Implement beginnings of generic device management interface +- Bugfix: avalon: Fix LIFE_INIT2 setting +- Add LIFE_INIT2 status (safe to call functions, but not mining yet) for devices +that want to report initialization status in their statline +- Bugfix: modminer: Only program once for --force-dev-init +- Bugfix: x6500: Only program once for --force-dev-init +- fpgautils: Workaround and document Xcode clang bug +- Bugfix: avalon: Correctly claim serial port +- Bugfix: -S all: Mac OS X needs to probe /dev/cu.*, not just /dev/cu.usb* +- cpu & opencl: Refuse to detect more than once +- cpu & opencl: Respect scan-serial auto/noauto instructions +- ft232r & libztex: Skip probe of claimed devices +- fpgautils: Check for devices being claimed before calling detectone from autodetectors +- x6500 & ztex: Claim USB devices +- fpgautils: Implement bfg_claim_usb for claiming devices by USB bus number and +address +- fpgautils: Replace serial_claim with bfg_claim_serial using a more cleanly +extensible interface and implementation +- fpgautils: serial_claim: Include a bus enum in hash key +- Add serial port claiming logic to avalon, bitforce, and modminer drivers +- RPC: "devscan" command to probe for new devices +- New (internal) scan_serial function to probe for new devices at runtime +- Split out per-cgpu temperature configuration code to load_temp_config_cgpu +- DevAPI: Modify add_cgpu to use temporary devices_new array, so detection can +be done without touching live variables +- Move more cgpu initialization to allocate_cgpu +- Move devtype default assignment to allocate_cgpu +- Move cgpu startup routine to new start_cgpu function +- Move cgpu_info allocation to new allocate_cgpu function +- Move *.drv_detect calls to a new drv_detect_all function +- DevAPI: add_cgpu: There is no need to hold mutexes while creating devices +- Bugfix: cpu: Update device "kernel name" with auto-selected algorithm +- usbtest: Improve portability to at least 2.7 and 3.2 +- usbtest: Avoid messing up the display by escaping weird bytes via repr() +- usbtest: Skip last 2 optional parameters, since we use the defaults and they +are not in older versions of pyserial +- Bugfix: bitforce: ZOX limits results to 16 results per call, so repeat ZOX +until there are fewer +- Bugfix: Initialization for bfgtls needs to be done in each thread +- Bugfix: stratum: Be patient with stratum lines that come in slower than we can +process them +- Use bfg_strerror in locations previously just logging raw error numbers +- Bugfix: stratum: Log WSAGetLastError() for error number on recv failures on +Windows +- Use bfg_strerror where it is already needed (for thread-safety) +- New thread-safe bfg_strerror function to portably stringify error codes +- Bugfix: bitforce_queue: Initialize buf2 so errors don't cause the work queue +to flush +- TUI: Display percentage invalid of found nonces with hw errors +- Bugfix: modminer & x6500: Increment *->diff1 for all bad nonces +- percentf2 that takes t as precalculated total +- Keep track of bad nonces independently from generic hw errors +- inc_hw_errors: Resolve cgpu outside of mutex +- Use inc_hw_errors function at every site which increases hw_errors + + +BFGMiner Version 3.1.1 - June 22, 2013 +- stratum: Deliver exact socket-error within the debug error message +- Don't install docs for (compile-time) disabled functionality +- Bugfix: Handle make dependencies on subdirectory files properly +- Bugfix: Use EXTRA_*_DEPENDENCIES for Cygwin workaround, to fix program make +dependencies +- Support new overclocking speeds for avalon: 325, 350 and 375 +- Bugfix: logging: Since we are inlining snprintf, stdio.h is needed +- Bugfix: serial_autodetect_ftdi: Debuglog FTDI COM port mappings returned, fix +type of FT_HANDLE +- Bugfix: Allow starting non-libusb devices if libusb_init fails +- Bugfix: Add missing newline to libusb_init failure message +- Bugfix: opencl: Remove unnecessary casts from rot() macro, which created type +issues +- Bugfix: Remove unused variables +- Suspend stratum connections when we know they've failed and don't try to recv +data from them once the socket no longer exists. +- applog/quit fix GPU errors created +- logging remove extra added +- remove varargs from logging/quit/in general as much as possible +- compile unix code on Mac OS X fixes not finding the config file in $HOME +- Create a pool_localgen bool function for testing when a pool can generate work +locally. +- Use mining start time for device MH/U calculations +- Bugfix: Save start time for stats to correct "Elapsed" key on "stats" RPC +request +- modminer: tidy up free in device detect function +- bitforce: RPC pgaset fanmode 9 for auto fan control +- Bugfix: usbtest: Correct obvious typos +- Initial import of usbtest.py script +- Include microseconds in log output with new --log-microseconds option +- bitforce: Workaround chip ids not necessarily being in order by choosing +processor count based on expected chip ids rather than parallelization +- serial_autodetect_ftdi: Debuglog FTDI COM port mappings returned +- Bugfix: On stratum disconnect, clear stratum_active and stratum_notify +atomically along with sock +- Windows: Use backtrace.dll to print usable backtraces to stderr on crash +- Bugfix: bitforce: parallelized: Properly handle parallelized protocol with +only 1 chip +- Bugfix: bitforce: XLINK: Increment boardno when moving on to the next board +- bitforce: XLINK: Update to use actual length,xlinkid header order +- Bugfix: bitforce: XLINK: Avoid trying to send 0 bytes after each write +- Bugfix: opencl: Build fpgautils even if OpenCL is the only driver, now that it +uses it for kernel-finding +- Bugfix: Do not try to call get_stats or get_statline* if device is still +initializing +- Bugfix: opencl: Add missing include for fpgautils.h (needed for +open_bitstream) + + +BFGMiner Version 3.1.0 - June 13, 2013 +- Bugfix: openwrt: Expect fixed bitstream path for input +- Improve Makefile organization and fix "make install" +- icarus: Upgrade work division autodetection probe to be faster and also detect +8 core +- Calculate rejection percentage based on weighed shares, not absolute counts +- Count weighed discarded (stale) shares per cgpu +- Bugfix: Cleanly count discarded (stale) shares without overlapping +devices/sshare locks within clear_stratum_shares +- configure: Enable Avalon support by default now that it behaves reasonably +- avalon: Since detection is not really implemented, only probe devices when the +driver is specified to -S by name (eg, "avalon:/dev/ttyUSB0") +- Bugfix: bitforce_queue: Never try to reinitialize a slave processor +- Bugfix: bitforce_queue: Use work_list_del everywhere we remove from work_list +to ensure work gets freed properly when done +- Reduce HW error logging to debug level, so it doesn't clutter the TUI log by +default +- DevAPI: When a device has more than 26 processors, represent them as aa-zz +- bitforce: bitforce: Fix TUI display of slave processors on parallelized boards +- bitforce: Only display temperature in TUI for the first chip on parallelized +boards +- Bugfix: bitforce: Set temperature for all processors on the board +- Bugfix: bitforce_queue: Initialize proc->device_data to board data for +parallelized chip processors +- Bugfix: bitforce_queue: Defer nonce count check until after thiswork has been +identified (or handled as NULL) +- avalon: avalon_clear_readbuf can simply wait for a single read timeout on +Windows to avoid select +- avalon: Simplify avalon_get_result by using avalon_gets +- avalon: Go back to good old serial timeouts for gets, since select() is for +sockets (only, on Windows) +- Updated api.c to return the hashrate with 3 decimal places +- Change hashrate display to never display 3 fractional digits, because it looks +a bit ugly +- bitforce: Credit hashrate to the correct chip on parallelized devices +- Re-set work thr_id on share submissions, to ensure the result gets credited to +the correct device in case of shared job queues (as in BitForce long boards) +- bitforce: Turn parallelization into separate logical processors for more +details on each, including working with XLink +- bitforce_queue: Implement job sanity checks using new "ZqX" for devices using +parallelization +- bitforce_queue: Minimal support for parallelization +- Add --device-protocol-dump option to debuglog low-level bitforce protocol +details +- When shutting down, set work restart flag (and trigger notifier) to help +mining threads escape to their main minerloop (and check for shutdown) +- Document and check for uthash version 1.9.2+ +- Bugfix: Don't report failure for graceful mining thread shutdown +- Name devices in mining thread failures +- Warn about killing mining threads +- Bugfix: Wake up mining threads when asking them to shutdown +- Disable pthread cancel within curses locking +- Shorten the avalon statline to fit in the curses interface and show the lowest +speed fan cooling the asic devices. +- Change switch_compact function name to switch_logsize to be used for other +changes. +- Only adjust cursor positions with curses locked. +- devs display - fix GPU duplicate bug +- basic copyright statement in API.java +- Change the --device parameter parsing and configuration to accept ranges and +comma separated values. +- Modify scrypt kernel message. +- Check for pool_disabled in wait_lp_current +- Check for pool enabled in cnx_needed. +- Add README.ASIC to debian packaging and make-release +- Document avalon options in ASIC-README +- Create README.ASIC with basic summary of supported ASIC devices. +- Do avalon driver detection last as it will try to claim any similar device and +they are not reliably detected. +- Set the fanspeed to the nominal chosen for GPUs. +- Clamp initial GPU fanspeed to within user specified range. +- Avalon fan factor is already multiplied into the info values. +- Get rid of zeros which corrupt display. +- Logic fail on minimum fanspeed reporting. +- Provide a workaround for fan0 sensor not being used on avalon and pad fan RPM +with zeros. +- Add ambient temp and lowest fan RPM information to avalon statline. +- Display max temperature and fanspeed data for avalon. +- Set devices to disabled after they exit the hashing loops to prevent the +watchdog thread from trying to act on them. +- Scanhash functions perform driver shutdown so don't repeat it. +- Change the opencl shutdown sequence. +- Send the shutdown message to threads and do the thread shutdown functions +before more forcefully sending pthread_cancel to threads. +- Icarus report data direction with comms errors +- Execute driver shutdown sequence during kill_work. +- Provide an nusleep equivalent function to nmsleep. +- Set avalon_info to device data void struct. +- Make submit_nonce return a bool for whether it's a valid share or not. +- Do a non-blocking read of anything in the avalon buffer after opening the +device. +- Assign the avalon info data to the device_data in cgpu_info. +- Rename cgpu_data to use new device_data +- miner.h remove unused device_file and add device_data +- Must unlock curses as well in logwin_update. +- icarus report usb write error information +- Make mining threads report out during work submission. +- submit_work_async is no longer used directly by driver code. +- Create a logwin_update function which mandatorily updates the logwin and use +it when input is expected to prevent display refresh delays. +- All stratum calls to recv_line are serialised from the one place so there is +no need to use locking around recv(). +- Only allow the mining thread to be cancelled when it is not within driver +code, making for cleaner shutdown and allowing us to pthread_join the miner +threads on kill_work(). +- Implement pthread_testcancel replacement for BIONIC +- Attribute whatever stats we can get on untracked stratum shares based on +current pool diff. +- Downgrade OpenCL headers to 1.0, which work fine for our purposes and are more +compatible +- icarus: If work_division autodetect fails, just use the old default of 2 +- avalonhost-raminst script to help with installing to RAM on Avalon-host +routers +- Attempt to probe /dev/cu.usb* for fallback "-S all" +- openwrt: Download uthash dependency +- Bugfix: openwrt: Always build with libsensors support disabled +- configure: Check for uthash headers +- Bugfix: ztex: Only destroy libztex device after the last handle to it has been +released +- ztex: Remove libztex slave device interface, simply passing fpgaNum to +selectFpga +- Bugfix: cpu: Fix yasm and sse2 detection +- cpu: Check for SSE2 support independently from yasm +- Bugfix: cpu: Make sure to link libsse2cpuminer.a before x86_32/libx8632.a +- Bugfix: cpu: Only build libsse2cpuminer iff yasm is available and targetting +x86_32 +- Bugfix: Free work only after deleting it from list +- Remove embedded uthash.h and utlist.h from Makefile +- windows-build.txt: Update for system uthash +- Remove embedded uthash (and add dependency on system uthash) +- Replace elist.h with utlist.h +- Bugfix: Fix build with CPU mining and *without* yasm +- cpu: Be explicit about size of sha256_init address +- cpu: Add --algo fastauto (new default) to detect a usable algorithm without +taking over a minute +- cpu: Default to --algo auto +- cpu: Support all platform-applicable assembly algorithms, even if used CFLAGS +don't support them +- Ubuntu: Updated changelog, added scrypt support. +- cpu: Set fixed symbol names for stuff shared with assembly +- cpu: Create Mach-O asm binaries on Darwin-based systems +- Bugfix: cpu: Use COFF yasm binfmt on Cygwin +- Bugfix: cpu: Get correct nonce from data, where the CPU sub-drivers leave it +- Remove redundant "Reject ratio" in exit-time summary +- Apply "R+S(%)" formatting to long-form statistics +- Group stale shares in with rejects (but still distinctly counted) and make the +percentage be (reject+stale)/total +- Include rejected shares as a percentage +- Move Utility and Best Share to status line +- Remove LW from status line, since it is basically useless +- ztex: Clean up a lot of ugly casting +- Bugfix: Correctly avoid SIGPIPE on Mac +- Make set_work_target a function to set a specified char as target for use +elsewhere. +- Minor typo. +- Support more shares to be returned for scrypt mining. +- Set all stratum sockets to nonblocking to avoid trying to use MSG_DONTWAIT on +windows. +- Only use MSG_NOSIGNAL for !win32 since it doesn't exist on windows. +- Use MSG_NOSIGNAL on stratum send() +- Set TCP_NODELAY for !linux for raw sockets. +- Use TCP_NODELAY with raw sockets if !opt_delaynet +- Recheck select succeeds on EWOULDBLOCK for stratum. +- Don't use TCP_NODELAY if opt_delaynet is enabled with stratum. +- Fix warnings in avalon driver. +- correct applog typing +- Simplify the many lines passed as API data in the avalon driver now that the +API does not need persistent storage for the name. +- Duplicate the name string always in api_add_data_full to not need persistent +storage for names passed to it. +- Add extra matching work count data in API for Avalon with 4 modules. +- Clean up summary slightly better on exit. +- opencl: Disable using binary kernels on Apple by default +- Use sock_blocks in api.c +- Fix build and distdir. +- compile on win32 +- Update README.scrypt with improved hashrates for 7970. +- Use copy_time helper throughout miner.c +- Provide wrappers for commonly used timer routines with API stats. +- Use flip32 function instead of open coding it in gen_stratum_work. +- Move util.c exports to util.h +- Replace gettimeofday usage with cgtime +- Adopt gettimeofday wrapper from cgminer (cgtime) that is always called with tz +set to NULL and increases the resolution on windows. +- Add high resolution to nmsleep wrapper on windows. +- Bugfix: Export stats_lock for deviceapi +- Set default ocl work size for scrypt to 256. +- fliter out the wrong result from adjust fan code +- Set last device valid work on adding device. +- Make scrypt submission use the submit_nonce code, with nonces matching +endianness. +- Increment hardware error count from the one site. +- compile avalon driver on win32 and win64 +- build out of source dir +- Rename scrypt regenhash function for consistency. +- Add Mac FAQ. +- Further driver FAQs. +- Check for work restart after disable in the hash queued work loop since it may +be a long time before we re-enable a device. +- Unconditionally test for many wrong results on avalon and reset to avoid +passing a corrupt avalon result to temperature code. +- Only reset an avalon device with no results when there are no results +consecutively. +- More FAQs. +- Avoid applog in recalloc_sock. +- Avoid applog under cg_wlock. +- Put spacing around locking code for clarity. +- Avoid applog under pool_lock. +- Avoid more recursive locks. +- Avoid applog while ch_lock is held. +- Avoid recursive locks in fill_queue. +- Variable is already initialised in global scope. +- More GPU FAQs. +- More README faqs. +- Yet more README faqs. +- Add more FAQs to README. +- Wrap result wrong tests in avalon scanhash in unlikely() and only consider a +hash count of zero wrong if a restart wasn't issued. +- avalon: if result_wrong >= get_work_count jump out the read loop +- Fix warning on 32bit. +- fix the fan control on max temp2/3 +- for some reason network down. one simple bfgminer command: "bfgminer -o +127.0.0.1:8888 -O fa:ke --avalon-options 115200:32:10:50:256" can idle the +avalon for safe power and protect chip +- if hash_count == 0; reinit avalon, fix the 0MHS bug use the max value of temp1 +and temp2 for fan control +- Reinstate the matching_work_count per subdevice on avalon based on the work +subid. +- Rationalise and simplify the share diff and block solve detection to a common +site. +- subid field for devices that do not yet support the distinct device/processor +interface +- Make the avalon array size a macro. +- Use replacement of work items in the avalon buffer as needed instead of +flushing them. +- Reinstate wrong work count to reset avalon regardless and display number of +wrong results. +- select() on serial usb in avalon does not work properly with zero timeout. +- Use no timeout on further reads in avalon_gets +- Do sequential reads in avalon_get_reset to cope with partial reads. +- Show read discrepancy in avalon_get_reset. +- Reuse avalon_get_work_count variable. +- Check for AVA_GETS_RESTART when deciding if avalon has messed up. +- Make the detection of all wrong results on avalon much more conservative to +avoid false positives on work restarts. +- Show error codes on select and read fail in avalon. +- If we get a restart message in avalon_gets still check if there's a receive +message to parse first without a timeout before returning AVA_GETS_RESTART. +- avalon_gets is always called from the one call site so inline it. +- The read_count is unused by the avalon get result code and no longer required +for avalon reset so simplify code removing it. +- Use a separate avalon_get_reset function for resetting avalon instead of using +avalon_get_result. +- The current hash count returned by avalon scanhash is just an obfuscated +utility counter so make it explicit. +- Check for a restart before a timeout in message parsing code in avalon. +- We should check for a restart message before checking for a timeout in avalon +scanhash. +- Store the subid for the work item in avalon. +- Fix record_temp_fan function in avalon driver. +- Remove inappropriate memset of struct avalon result which was corrupting fan +values. +- Only do_avalon_close once on multiple errors. +- Reset the result_wrong count on block change in avalon scanhash to prevent +false positives for all nonces failed. +- Small timeouts on select() instead of instant timeout increase reliability of +socket reads and writes. +- Rotate the avalon work array and free work on AVA_SEND_BUFFER_EMPTY as well. +- Only get extra work in fill_queue if we don't have any unqueued work in the +list. +- Don't get any work if our queue is already full in avalon_fill. +- Free avalon->works in the event we call avalon_prepare on failure to +initialise. +- Fix warnings. +- Create an array of 4 lots of work for avalon and cycle through them. +- Remove unused per unit matching work count for avalon. +- Rename the confusing avalon_info pointer. +- Simplify avalon scanhash code using the new find_queued_work_bymidstate +function. +- Members of cgpu_info for avalon are not meant to be in the union. +- Use correct struct device_drv for avalon_drv. +- Check enough work is queued before queueing more in avalon_fill. +- Actually put the work in the avalon queue. +- Rename avalon_api to avalon_drv. +- First draft of port of avalon driver to new cgminer queued infrastructure. +- Minor README updates. +- README.GPU: Properly warn about overclocking damage +- Add example 7970 tuning for scrypt in readme. +- Update driver recommendations. +- Add extensive GPU FAQs for the flood of new Scrypt miners. +- Bugfix: Expect bitstreams and kernels to be in the srcdir, not build dir +- cpu: Prefer sse4_64 algorithm if supported +- cpu: sse2_32: Force bare symbols for cross-asm/C symbols +- Compile CPU mining for win32 and win64 +- configure: Check for pthread in -lwinpthread +- Use has_pth flag instead of trying to mess with pthread internals +- configure: Explicitly check for nanosleep +- configure: Include "no" response in BFG_PTHREAD_FLAG_CHECK +- miner.h missing extern +- Update links and recommended SDKs. +- Bugfix: README.GPU: Fix some typos +- Update README to match changes to display. +- Remove increasingly irrelevant discarded work from status lines. +- Remove increasingly irrelevant GW value from status. +- README.GPU: Correct terminology +- Update README about intensity. +- Bugfix: Restore always autodetecting stratum as non-scrypt +- icarus: Replace default of 2 work_division/fpga_count with autodetection of 1, +2, or 4 +- Update scrypt readme with newer information and to match changes in code. +- Set default GPU threads to 1 for scrypt. +- Connect backup stratum pools if the primary pool cannot deliver work. +- Use a new algorithm for choosing a thread concurrency when none or no shader +value is specified for scrypt. +- Do not round up the bufsize to the maximum allocable with scrypt. +- Remove the rounding-up of the scrypt padbuffer which was not effectual and +counter-productive on devices with lots of ram, limiting thread concurrencies +and intensities. +- Make pool adding while running asynchronous, using the pool test thread +functionality. +- Only curl easy cleanup a stratum curl if it exists. +- Add intermediate variants of cglocks that can be up or downgraded to read or +write locks and use them for stratum work generation. +- Move the stratum data to be protected under a new cg_lock data_lock. +- Convert the ch_lock to cg_lock. +- Convert the control_lock to a cg_lock. +- Remove unused qd_lock. +- Implement cg_lock write biased rwlocks. +- Don't start testing any pools with the watchpool thread if any of the test +threads are still active. +- Set sockd to false should curl setup fail on stratum. +- Reopen the socket whenever we're retrying stratum. +- Set pool died on failed testing to allow idle flag and time to be set. +- Remove unused pthread_t typedefs from struct pool. +- Perform pool_resus on all pools that are found alive with the test pool +threads. +- Use pool_unworkable in select_balanced as well. +- Differentiate pool_unusable from pool_unworkable. +- Keep a connection open on higher priority stratum pools to fail back to them. +- Set the wrong bool in pool_active +- Only bypass unusable pools if they're not the selected ones. +- Find the first usable pool in preference to the current pool in select_pool +for work. +- Add a pool_unusable function which checks if a pool is stratum but not active +to use within switch_pools. +- API no longer ignore send() status +- API make the main socket non-static +- Start the stratum thread only if we successfully init and authorise it, +otherwise unset the init flag. +- Make the initialisation of the stratum thread more robust allowing the +watchpool thread safe access to it after the stratum thread is started. +- Shorten the time before keepalive probes are sent out and how frequently +they're sent with stratum curls. +- Display select return value on select fail in stratum thread. +- Clear the socket of anything in the receive buffer if we're going to retry +connecting. +- Perform pool resus on pools that were not set as the initial pool at startup. +- Allow pools to be resuscitated on first startup by the watchpool thread. +- Check all pools simultaneously at startup switching to the first alive one to +speed up startup. +- Close any sockets opened if we fail to initiate stratum but have opened the +socket. +- API use control_lock when switching pools +- Clear last pool work on switching pools if the current pool supports local +work generation or we are in failover only mode. +- make rw locks: mining_thr_lock and devices_lock +- work queues - remove new but unnecessary functions +- functions for handling work queues +- find_work() to find work in devices work queue +- Add a get_queued function for devices to use to retrieve work items from the +queued hashtable. +- Add the choice of hash loop to the device driver, defaulting to hash_sole_work +if none is specified. +- Add a driver specific flush_work for queued devices that may have work items +already queued to abort working on them on the device and discard them. +- Flush queued work on a restart from the hash database and discard the work +structs. +- Create a central point for removal of work items completed by queued device +drivers. +- Create a fill_queue function that creates hashtables of as many work items as +is required by the device driver till it flags the queue full. +- Create the hash queued work variant for use with devices that are fast enough +to require a queue. +- Make sure to do full avalon_init if the device_fd is invalid. +- Document extra zero byte in avalon_reset. +- Microoptimise likely paths in avalon_gets. +- Make sure to set timeout to 100ms instead of 1ms in avalon read loop for +select. +- Make sure to get time of first response in avalon read loop. +- Use select for a reliable timeout in avalon read and don't read 1 byte at a +time, optimising read loop. +- We should break on the loop on a work restart in avalon, and only consider all +errors if we actually have gotten some results. +- Avalon init on comms error as well. +- Reinit avalon device in case of FPGA controller mess up. +- Increase reliability of avalon startup by only opening and resetting the +device once, looking for the id sequence offset by one byte as well, and still +ignoring if it's wrong, assuming it is an avalon. +- Nest avalon_decode functions to avoid doing unnecessary lookups once we have +found the nonce. +- Use htole32 wrapper for nonce encoding in avalon. +- Remove unused rev8 function from avalon driver. +- Remove const qualifier from driver structs +- rename device_api -> device_drv and all related api -> drv +- rename get_proc_by_id() to get_devices() +- Wrap access to devices array under a mutex +- Provide wrappers for grabbing of thr value under the mining_thr_lock. +- mutex all access to mining_thr +- Split thr_info array into control_thr and mining_thr pointers so more mining +threads can be added later +- Update the hashmeter at most 5 times per second. +- Speed up watchdog interval and therefore display updates to 2 seconds. +- Add README.GPU to EXTRA_DIST. +- Split out the GPU specific information from the README into a README.GPU file. +- Update docs and reorder README to show executive summary near top. +- Add more FAQs about crossfire. +- Convert error getting device IDs in ocl code to info log level only since +multiple platforms may be installed and the error is harmless there. +- Unnecessary extra array in ocl code. +- Cope with the highest opencl platform not having usable devices. +- Update kernel file names signifying changes. +- Use constants from the array of __constants throughout the diablo kernel. +- Create a __constant array for use within diablo kernel. +- Use global constant arrays for all other constants used in scrypt kernel. +- Use global __constants for sha functions in scrypt kernel. +- Use constants for endian swap macros. +- Revise scrypt kernel copyright notice. +- Separate out additions in scrypt kernel. +- Reuse some Vals[] variables that can be assigned to constants earlier in the +poclbm kernel, making for fewer ops. +- Put all constants used in poclbm kernel into __const memory array to speed up +concurrent reads on the wavefront. +- opencl: Support for reading temperature from free software radeon drivers via +libsensors + + +BFGMiner Version 3.0.3 - June 13, 2013 + +- make-release: Include all submodules, recursively +- Remove API.java example (no copyright license) +- Minimally fix "make install" to ignore bitstream sources +- Add submodule for ZtexBTCMiner (aka ztex_ufm1_*) +- Add submodule for X6000_ztex_comm4 (aka x6500-overclocker-0402) +- ztex: Use standard file header/comment formatting, and update license to GPLv3 +- bitforce: Allow a longer timeout (1250ms) for ZCX (Device Information) +commands +- Bugfix: pdcurses doesn't like changing logwin size without clearing it also, +so do that in display options +- -S all: Start QueryDosDevices probe with 256-byte buffer +- Use common code to ensure the prefix of -S *:all remains in all +implementations of it (/dev glob was removing prefixes) +- bitforce_queue: Ensure comma following nonce count is there, to error cleanly +- bitforce: Report queue send failures, and count as hw errors +- Bugfix: bitforce_queue: Don't try to send ready-to-queue work to device, when +there is no ready-to-queue work +- Bugfix: bitforce: Clear want_to_send_queue flag when flushing queue, since we +can't send an empty queue +- bitforce: Include new total queued count in flush debugging +- Bugfix: bitforce_queue: Implement a minimum wait time of 10ms +- README: Document serial device format for Mac OS X +- Bugfix: cairnsmore1: Enable building with libudev autodetection even if only +icarus drivers are enabled +- Bugfix: sysfs autodetect: Continue searching even after finding one tty (fixes +multiple ttys per device, such as some Cairnsmore1s) +- Bugfix: ztex: Avoid destroying libztex device in case other processors are +still in use (fixes crash when 1.15y becomes unavailable) +- Update windows-build.txt +- ccan: Add missing copyright comment headers +- Remove obsolete mknsis.sh +- Add missing copyright sections to files that may need them +- Standard copyright format (including year) for adl_functions.h +- Bugfix: When disabling device, ensure its prev_work (if any) gets freed +properly +- Check stratum socket exists and is writable before even considering whether +the sessionid is the same or not +- Bugfix: Check that the stratum_share struct for a failed submission is still +in the submission hashtable before trying to delete it +- README: Add missing documentation for CPU algorithms cryptopp_asm32, sse2_32, +and altivec_4way +- Bugfix: icarus: Check work restart before timeout +- Bugfix: icarus: Debuglog the correct read timeout (and omit from work restart +since there's no trivial way to get it) +- README: Update links +- Bugfix: cpu: Fix warning on Win64 +- Bugfix: avalon: Strict formatting +- Bugfix: Cleanup trivial warnings +- Bugfix: bitforce: Seek to end of nonce counter to find nonces, in case there +are more than 9 +- Bugfix: Build hexdump.c into the project normally like everything else +- Bugfix: Really fix device entries in saved config file +- Update the write config to properly record device entries and remove disabled +option. +- avalon: Really fix applog formatting +- va_copy is meant to be matched by a va_end in log_generic. +- Further fix distdir for hexdump.c +- Fulltest is true if value is <= target. +- Fix warning with no curses built in. +- Bugfix: configure: Check NEED_FPGAUTILS correctly +- configure: Better grammar for --enable-cpumining help +- Bugfix: Check for SSE 4.1 support before building sse4_64 asm CPU miner (uses +MOVNTDQA instruction) +- Bugfix: elist: Use uintptr_t for member offset +- Bugfix: opencl/adl: Fix format string +- Bugfix: opencl: Correct usage of formatted prints +- Increase fd limits as much as possible at startup +- Bugfix: bitforce: bulk queue: Cleanly retry for high temperature recovery +- Fixed deps for raring, which has newer libudev1. +- bitforce: debuglog actual result data +- Bugfix: Missing 'else' can result in null pointer dereference in race +- Minor grammo in avalon driver. +- Make avalon temperature reading LOG_INFO level. +- Fix the problem of seting up termio of ttyUSB0 for icarus. the CSIZE is the +mask of CS2/4/8 +- bufsize is an unsigned integer, make it so for debug. +- Bugfix: bitforce: Include get_api_stats in BQUEUE mode +- Bugfix: Always compile support for commandline --temp-target and +--temp-cutoff, and write them in the config for all devices +- Bugfix: Ensure cURL timers get set correctly in submission thread +- Bugfix: modminer: Remove unused parameter to sprintf +- Bugfix: modminer: Use correct format for bytes left in bitstream upload +message +- Bugfix: Access strategy name string directly instead of accidentally +- Add printf-format syntax checks to more functions that should use it +- AUTHORS: Add more contributors +- Support configure flag --with-system-libblkmaker to allow building without the +bundled copy +- Bugfix: Use HTTP/1.1 compatible product token for User-Agent header + + +BFGMiner Version 3.0.2 - April 28, 2013 + +- Receive failures in recv_line should unconditionally fail. +- Use sock_blocks function for stratum send and receive. +- Avoid applog under stratum_lock in __stratum_send. +- Create an OS specific sock_blocks function. +- There should be no error response code with return value 0 in recv_line. +- Check for errors on stratum recv for any recv return value less than 1 and +only parse the response if it's positive. +- Avoid applog under stratum_lock in recv_line. + + +BFGMiner Version 3.0.1 - April 24, 2013 + +- Bugfix: configure: Move actual roundl macro back to miner.h after math.h +should be included +- Bugfix: configure: Use dummy pointer to correctly detect roundl when conftest +main is missing argc parameter +- Bugfix: configure: Use variable argument to roundl to prevent compilers from +optimizing it out entirely +- Remove bitstreams from Windows binary distributions (README directs users to +download source and copy them) +- make-release: Remove autom4te.cache from distributed source +- Bugfix: Omit --no-opencl-binaries option from build if OpenCL is not being +compiled +- Bugfix: Check that all pools have URIs set before starting +- Bugfix: bitforce: Make noncebuf large enough for max qresults +1 (for OK line) +- opencl: Ability to avoid using binary kernels with new --no-opencl-binaries +option +- README: Include jansson PKG_CONFIG_PATH in example for Mac +- Include trailing \0 with coinbase sigs if there's room +- Differentiate socket closed from socket error in recv_line. +- Add new best share info to verbose logging. +- Add notice for when network diff is changed. +- convert sleep(const) to nmsleep() +- Rename longpoll threads according to what pool they're associated with +- miner.php report 'Last Valid Work' as time before request +- API V1.25 - add 'Last Valid Work' time for each device +- add 'count' to customsummarypage 'calc' +- Bugfix: ztex: Initialize fw_buf pointer to NULL so a free before allocation is +safe +- Cleanup when stratum curl fails to initialise. +- LTC text typo +- Recreate cURL for new stratum connections, and clear stratum_notify on +suspending them +- clear_stratum_shares: Rename diff_stale variable to diff_cleared +- MMQ it's a bitstream +- Update a pool's last work time when the work is popped as well as staged. +- Extend stratum connections another minute (total 2 minutes) after the last +work item was staged, and maintain last_work_time for non-stratum pools. +- Fix --benchmark generating valid work for cgminer. +- Bugfix: Correct pdbuilder result directory +- Omit add_serial_all code when serial support is not wanted +- Use configure to detect presence of roundl to avoid redefining an actual +function (possibly inline) +- Bugfix: roundl: Add needed parenthesis to perform ?: before + +- Bugfix: ft232r: Defer allocating structure until after USB endpoint is +successfully opened, so it won't leak in case of failure +- Bugfix: ztex: Free bitstream in memory when done with it +- Bugfix: Safely handle all-space cURL debug messages, should they ever happen +- Silence warnings about poor format usage for quit() +- Apply noreturn and printf-format attributes to quit() function definition +- Bugfix: set_serial_rts get flags to manipulate them correctly +- Bugfix: Missing return for /dev globbing +- Bugfix: Free unused work when retrying failed lp request +- Display processor name with thread disabled/re-enabled messages +- Move best share to top summary line, and add network difficulty to block line +- opencl: Default to phatk kernel for Mesa platform +- opencl: Default to single thread with Mesa OpenCL +- opencl: Check for Mesa OpenCL and avoid using binary kernels with it +- bitforce: Never increase bulkqueue poll wait time during queue underruns +- bitforce: Start off polling bulk queue every 100ms +- bitforce: Log device queue size after getting bulk results +- bitforce: Ensure bulkqueue polling occurs at least once a second +- opencl: Include OpenCL platform in kernel binary filenames +- bitforce: Use bulk queue mode for all SC devices +- Bugfix: bitforce: When reinitializing, free all known works to avoid +decrementing reset queued counter +- bitforce: Handle timeout during ZOX as cleanly as possible +- Bugfix: bitforce: Make reinitialization more complete and safe +- Bugfix: bitforce: Close opened fd if reinit fails +- Bugfix: bitforce: Retry ZGX until device is NOT busy +- bitforce: Log when zero queued results are received + + +BFGMiner Version 3.0.0 - April 5, 2013 + +- Update libblkmaker to 0.3.0 +- debian: Include new api-example.py in docs +- added example for Python using the RPC API +- added SPEC file for SUSE distributions +- Bugfix: bitforce: Free initialization data to avoid trivial one-time memory +leak +- Support for local submission of found blocks (GBT only) +- bitforce: RPC pgaset fanmode 0-5 for manual fan control +- bitforce: More debugging information +- Bugfix: modminer: Since RPC always includes the temperature, we don't need to +add it specially +- bitforce: Expose dual temperature sensors to RPC +- bitforce: Support for up to 2 temperature sensors per processor +- Bugfix: bitforce: BFP_QUEUE: Attempt to recover from extra queue results, or +the next job finishing early +- bitforce: Always send a new job ASAP after flushing the queue +- bitforce: Implement "Queue Job Pack" (ZWX) and use it for XLINK devices to +avoid USB latency issues +- bitforce: Ignore INPROCESS added to ZOX response +- Implement minerloop_queue for devices that process work items too fast to keep +track of which one they're currently working on +- bitforce: Split ZOX command into its own function +- Bugfix: DevAPI: Free work when preparing it fails +- DevAPI: Abstract get_and_prepare_work for minerloops +- DevAPI: Move select() logic from minerloop_async to do_notifier_select +- Clarify stratum mining.set_difficulty debug log message +- No longer call configure from autogen.sh +- Bugfix: bitforce: Ensure result_busy_polled gets set for queue mode to avoid +unnecessary 10ms wait times +- Bugfix: bitforce: Use common code for end of job_get_results, so queue results +don't short-circuit timing code +- Bugfix: bitforce: Ensure "OK" doesn't remain in queued results buffer +- Bugfix: bitforce: next_line needs to increment beyond the newline character +- Update README for x970 memdiff values. +- Do not scan other gpu platforms if one is specified. +- Update README for sync objects on windows. +- Add information for setting gpu max alloc and sync parameters for windows with +scrypt. +- Whitelist AMD APP SDK 2.8 for diablo kernel. +- Show pool number in switch message +- Clear just the socket buffer when we don't care what is left in a stratum +socket. +- Clear the stratum socket whenever we are closing it since the buffer is going +to be reused. +- Do not continue work from a stratum pool where the connection has been +interrupted. +- Close any existing stratum socket if we are attempting to restart stratum so +the pool knows the connection has gone. +- Show mechanism of stratum interruption if select times out. +- Make stratum connection interrupted message higher priority to be visible at +normal logging levels. +- API add 'Network Difficulty' to 'coin' +- avalon: if all result are wrong in one batch read. reinit the avalon +- avalon: record the last result temperature info +- delay when close avalon; only record matched result +- avalon: fix no_matching_work only count when debug +- avalon: minor change +- avalon: add idle code +- avalon: fliter the temp_max >= 100, print the result for debug. +- avalon: export more data to API stats +- avalon: add default chip frequency +- avalon: fix the work_i3 init +- avalon: add reinit_device +- avalon: the temp_history_count base on timeout +- avalon: fix mistake on adjest_fan +- avalon.c: fix the copyright +- bfgminer-rpc: add -o option: no format, only the result +- avalon: update fan pwm +- avalon: update the FAN_PWM MAX/MIN +- avalon: minor change +- avalon: overclock code +- avalon: fix the display +- avalon: minor change +- avalon: fix the fan/temp control +- avalon: fix the temp_avg +- avalon: fix temp +- avalon: add fan/temp control +- avalon: add FAN speed factor +- avalon: add TODO on fan/temp control. cleanup detect +- avalon: add the gate_miner bits +- avalon: only send one byte on reset +- avalon: add support on send 2 bulk taskes at begin +- avalon: fix the hash_count return +- avalon: fix the LOG_WARNING +- avalon: add comment on hash_count +- avalon: WORKAROUND on hashrate +- avalon: update max miner_num +- avalon: add more info on api +- avalon: add nonce_elf and more info on match miner_num +- avalon: change reset to 300ms +- avalon: move bulk buffer to it's info structrue +- avalon: more work on hashrate and read_count +- avalon: add baud 38400 support +- avalon: fix nonce_range EB +- avalon: fix the hashrate wrong +- more info on avalon API +- avalon: fix the nonce_range EL +- avalon: fix the read count +- avalon: more work on nonce_range +- avalon: read() times and send delay fixed +- avalon: add the send delay option +- avalon: print out fan/temp info +- avalon: add the result info (fan/temp etc) +- avalon: more check on hardware error +- avalon: more work on get_work_count +- avalon: now we have dynamic get_work_count +- avalon: more work on parameters +- avalon: add timeout parameter +- avalon: baud as parameter now +- avalon: send work pitch should be : (15*(8+2)*4/19200)s +- avalon: more work on match work +- avalon: fix free_work +- avalon: continue on reset work. wait for buffer empty +- avalon: add options, if write() error. sleep(1) before reset() +- avalon: more cleanup +- avalon: finish read when Buffer empty +- avalon: fix the nonce EB issue +- avalon: MORE work +- avalon: fix the EB/LB issue +- avalon: some cleanup +- avalon: fix the first configure task +- more work on the avalon buffer +- avalon: fix the BIG_ENDIAN issue +- avalon: Fix the buffer statu +- change defines to avalon parameters +- fix the cts return +- avalon: change the data to uint8_t, add some test temp code +- avalon: fix task init +- avalon: more data format work +- change to avalon data format +- debug: add a debug hexdump.c +- avalon: add some code on match work +- avalon: try to correct the pool_status and dev_status +- avalon: more work on multi-works +- avalon: more work on read +- avalon: more work on get results +- more RTS code on avalon.c/h +- more RTS code +- avalon: some cleanup +- avalon: more work on new work queue structrue +- fpgautils.c: use lancelot as target +- avalon: since we submit task as bulk data. modify again +- add scanhash_queue +- renmae avalon.h to driver-avalon.h +- fpgautils.c: add get_serial_cts +- understand the avalon protocol more +- avalon: new software structrue but target as lancelot +- add avalon.h +- avalon: fix warning +- avalon: add TODO comments +- more AVALON defines +- avalon: more work +- add driver-avalon.c +- add avalon support to automake +- Default to work queue mode on BitForce SC devices +- bitforce: Implement support for non-contiguous XLINK slave addressing +- gnulib: stdint: fix build with Android's Bionic fox x86 +- gnulib: stdint: Improve support for Android. +- gnulib: stdint: Add support for Android. +- Check for ?e##toh macros independently from hto?e## +- If pthread_cancel is missing/emulated, set asynchronous thread cancel type on +stage, watchdog, watchpool, and longpoll threads since the emulation cannot +support deferred cancellation +- If pthread_cancel is missing (Bionic/Android), emulate it using pthread_kill +and pthread_exit +- configure: Intelligently detect what flags/libs get us working pthread, and +define HAVE_PTHREAD_CANCEL if pthread_cancel is available +- Bugfix: Initialize mutex_request to invalid so devices that don't use it +(bitforce) don't try to +- RPC: pools: Add "Message" to show last client.show_message received over +stratum +- Stratum: Support client.show_message method +- Don't retry without resume support, if the first attempt just timed out +- Bugfix: minerloop_async: Intelligently handle work updates and device disables +during transitions +- Bugfix: minerloop_async: Free old (unused) prepared work when replacing it +with an upgraded one +- Bugfix: Free pool sessionid before replacing it +- Bugfix: Stratum: Address dereference-after-free and memory leak introduced in +resume support +- Stratum: If old protocol fails as well, try to resume again next time around +- Bugfix: Stratum: Only failover to old mining.subscribe protocol if the +previous attempt was the new one (fixes a flood of retries) +- Try to extract the sessionid associated with mining.notify on 3rd level array +and submit it along with the userid to support mining resume, failing gracefully +and restarting if the pool rejects it. +- Cope with misread sessionid on stratum for now. +- Use the sessionid as passed on stratum connect to attempt to resume a +connection once and then clear it if it fails, to use a new connection. +- Move to storing the nonce1 in the work struct instead of the sessionid for the +now defunct first draft mining.resume protocol. +- Only continue submitting shares with mining.resume support on stratum when the +session id matches. +- Provide support for mining.resume with stratum, currently re-authorising after +successful resumption pending finalising of the protocol process. +- Provide basic framework for restarting stratum depending on whether resume +support exists or not. +- Abstract out the setting up of the stratum curl socket. +- Remove redundant setting of strings to NULL since the whole work struct is +zeroed. +- Only clear stratum shares mandatorily on stratum dropouts when the pool does +not support resume. +- Stratum: Keep trying to submit shares, even across reconnects +- Use new select loop primitives in submission thread +- Bugfix: Missing pool_no parameter to applog for no-stratum-sessionid debug +message +- Do as much outside of mutex locking of sshare_lock as possible. +- Remove last reference to struct work used outside the sshare_lock in +submit_work_thread +- Unlock the sshare_lock in submit_work_thread when all references to work and +sshare are complete. +- Bugfix: Copy and free sessionid on work objects +- Add timestamps to stratum_share structs as they're generated and copy the +stratum sessionid if it exists to stratum work generated. +- Store session id for stratum if the pool supports it for future mining.resume +support. +- Keep the unique id of each work item across copy_work to prevent multiple work +items having the same id. +- x6500: Never consider processors idle if they're enabled +- x6500: Make mutex management cleaner by blocking device select loop during +idle get_stats +- Bugfix: minerloop_async: Always refer to real thread for select loop +- Bugfix: Initialize work_restart_notifier[1] to INVSOCK instead of -1 to be +portable +- ztex: Use restart_wait to react quicker to work updates +- Handy TIMEVAL_USECS macro +- Restore blocking restart_wait function with nearly identical semantics as old +one +- Bugfix: bitforce: Rework sleep delay adjustment logic to properly deal with +more accurate timing readings (added in device API update) +- Hidden --force-rollntime option for getwork pools (use like --pool-priority, +after each pool definition) +- Include processor id in get_work logging +- Support for BIP23 BPE request target extension via new --request-diff option +- Hidden option to reduce "work update" messages to debug level: +--quiet-work-updates +- Change "work restart" to "work update" in messages to reflect reality more +accurately (no work is lost), and normalize case of "longpoll" +- HACK: Since get_work still blocks, reportin all processors dependent on this +thread +- Move FD_SETSIZE definition to configure so it affects everywhere it needs to +- Move absolute_uri function to util.c +- Remove now-unused blocking-wait code (restart_cond, restart_wait, and +stale_wait) +- Bugfix: bitforce: Zero hashes complete if we get an invalid response +- HACK: Since get_work still blocks, reportout all processors dependent on this +thread +- bitforce: Support for work queue protocol on BitForce SC devices +- Use new double-stage format for SC devices +- modminer+x6500: Expose frequencies to API in terms of MHz to be consistent +with ztex driver and cgminer +- bitforce: Replace (bool)cgpu->nonce_range with (enum)bitforce_data->proto +- bitforce: XLINK support for multiple processors +- bitforce: Prepare log messages for XLINK by separating into proc and dev +messages +- bitforce: Always use fd/mutex pointers on actual device, to prepare for XLINK +support +- bitforce: Get fd/mutex pointers only once per function +- bitforce: Abstract commands to bitforce_cmd1 (single-stage) and bitforce_cmd2 +(double-stage) functions +- bitforce: Debuglog device information during detection +- Bugfix: Missing includes needed on Windows +- Bugfix: Use waddstr instead of wprintw to display completed device summary +line, so literal %s don't get interpreted as formatting options +- Bugfix: bitforce: Avoid polling continuously between work restart and job +completion +- bitforce: Use poll device API when job_get_results needs to wait +- bitforce: Use poll device API when job_start needs to wait +- stale_work_future function to determine in advance if a work/share will be +stale at some future time +- bitforce: Minimally refactor to adapt to new minerloop_async +- minerloop_async: Break out of select on work_restart_notifier +- Replace UNIX-only work_restart_fd pipe with portable work_restart_notifier +- Bugfix: Clean out unused variables from minerloop_async +- Move new device API code to new deviceapi.c source file +- Make minerloop_async more async, using some callbacks to handle event +completions +- Split part of minerloop_async into do_get_results, and a bit other +reorganization +- Abstract select_timeout function to convert a realtime timeval to a timeout +pointer for select() +- Split part of minerloop_async into do_process_results, and don't allow +api->job_get_results to return hashes +- Split part of minerloop_async into do_job_prepare and do_job_start +- Initialize thr->tv_poll to -1 (disabled) +- Update the hashmeter one last time before disabling a device +- minerloop_async: Break out of select for wakeup notifications +- Replace mining thread queues (which were only used for wakeup pings) with +notifiers (which can be used with select and co) +- Unify all mining thread wakeup to mt_enable (simplifying code) +- Bugfix: get_statline: Correct device summary status, only showing DEAD or OFF +if it affects all processors +- Working processor disable/enable with new async minerloop (currently gets +stuck if all processors disabled) +- Bugfix: get_statline: Only care about the processor status if +--show-processors is set +- Bugfix: watchdog: Use processor thr_info even if it isn't a real thread +- Only support thread-per-device or N-threads-per-processor; simplify +work_restart check +- x6500: Remove mutex, since driver is single-threaded now +- Bugfix: Update utility every get_statline call, and include every processor +involved +- HACKING: New text file to document the internal workings of (currently) the +device API +- Bugfix: mining_threads is now a total of thr_info objects, not necessarily +actual running threads +- x6500: Working (but incomplete) asynchronous/single-threaded driver +- Incomplete (but workable) asynchronous minerloop +- Core support for managing multiple processors from a single thread +- Allow device drivers to implement their own minerloop +- Move cgpu_info and thr_info initialization to main, and ensure all get +initialized before starting any threads +- Refactor and simplify miner_thread (no major behavioural changes) +- Move difficulties to end of share result message, so they can be made to line +up nicely +- Bugfix: Consolidate share result message code (including fixing displayed +hash portion for stratum) +- miner.php: Include ProcID in Device column as a letter +- Show summaries per-device unless --show-processors is used (also available on +Display TUI menu) +- Order next_proc linked list in processor id order +- Consolidate processor summary line generation for TUI and text-only modes +- RPC: Update to include ProcID so multiprocessor devices can be understood +correctly +- RPC: Common function for adding device-identifying fields +- modminer: Make single-processor statline look like other temperature-only +statlines +- modminer: Split each FPGA into its own logical processor (in the same device +still) +- modminer: Get mutex pointer only once per function +- ztex: Combine master+slave devices into a single multiprocessor device +- Preformat dev_repr (device representation) and proc_repr (processor +representation) once for use everywhere +- x6500: Split each FPGA into its own logical processor (in the same device +still) +- x6500: Get mutex pointer only once per function +- Minimal support for defining devices with multiple logical processors +- Rename all README files to standard README.* style + + +BFGMiner Version 2.10.6 - April 5, 2013 + +- Bugfix: Restore missing variable +- Bugfix: openwrt: Never include _ in platform name +- Bugfix: Fixed typo in bfgminer-rpc usage +- pool_active: Ensure temporary curl is always cleaned up +- Try to find jansson via pkg-config first, and fall back to checking system +defaults if that fails +- Attempt to find libjansson via pkg-config if AC_CHECK_LIB fails +- Update scrypt readme re drivers and sdk. +- Bugfix: README: Move --device out of GPU only options +- Update .gitignore +- Added bfgminer-rpc binary to .gitignore +- Bugfix: Actually change to the newly selected pool when statum is inactive and +it decides to change +- Bugfix: modminer: Properly fail on dynclock error +- Bugfix: opencl: Clean pc_data->work before freeing pc_data +- Bugfix: Correct order of libblkmaker libraries so static builds work +- Bugfix: Need to ensure __BIG_ENDIAN__ is defined before including uthash.h +- Bugfix: Stratum: When destroying cURL easy handle, be sure to clear pool +stratum_curl pointer +- Bugfix: bitforce: Fix warning +- Bugfix: Stratum: Properly handle non-integer "id" for client.get_version +requests +- json_dumps_ANY utility function to portably implement json_dumps(..., ... | +JSON_ENCODE_ANY) +- Bugfix: bitforce: Free old name when updating it on reinitialization +- Stratum: Include pool number in send/recv protocol logging +- Include pool number in stratum thread name +- API always report failed send() replies +- API.java allow partial reads +- Bugfix: Stratum: Use curl_easy_cleanup to close connection, so cURL +understands what is going on +- Bugfix: hash_pop: If a work should be rolled, use a clone of it rather than +consume a rollable work +- openwrt: Move Makefile into a bfgminer subdirectory to avoid symlinking issues +- openwrt: Use --with-curses=ncurses to avoid ncursesw dependency +- configure: Support --with-curses=FOO to look for curses implementation in +libFOO +- Set pool socket to INVSOCK after closing connection, just in case +- Clean up compiler warnings +- Bugfix: Check that pool is active one last time before selecting it +- Bugfix: Trim whitespace (like newlines) off the end of debug info from +libcurl +- Bugfix: submit_nonce: Backup the original work->blk.nonce since the miner +code uses it to track work consumption +- Bugfix: Scheduler needs to unpause disabled devices, even if it isn't waking +them up +- Bugfix: Use SOCKETTYPE for notifiers, to avoid potential overflow on Win64 +- Bugfix: Some versions of MingW define localtime_r, but don't handle the +timeval.tv_sec case that we use; so undef any preexisting one and use our own +- Bugfix: reinit_gpu: Remember the selected device to correctly change +properties of +- Bugfix: cpu: reinit_device hasn't worked since 93b284d, so just remove it +entirely instead of letting it screw with thread 0 +- Document necessity to run ldconfig and possibly configure ld.so +- Bugfix: Complete startup after just one pool is found active, no need to wait +for the rest +- Bugfix: Update links +- miner.php: Replace PGA dev number with concatenated device ID +- Bugfix: miner.php: Display devices with aligned columns instead of assuming +they come out of the RPC aligned +- Bugfix: miner.php: Silence PHP "local timezone" warning +- Bugfix: api-example: Try to use BSD sockets on any non-Windows platform +- Bugfix: stratum: Delay mining.get_transactions request until after auth has +succeeded, so its failure doesn't abort the connection (also avoids any delay +from a large result) +- --no-getwork option to disable getwork protocol support +- Clarify dependencies with Debian/Ubuntu package names + + +BFGMiner Version 2.10.5 - February 8, 2013 + +- Bugfix: Actually increment template_nonce when we use it +- Change file modes. +- Fix logic fail on partial writes with stratum send that was leading to corrupt +message submissions. + + +BFGMiner Version 2.10.4 - February 7, 2013 + +- New platform ports: OpenWrt and Win64 +- Update official Windows build compiler and libraries: +- - Upgrade GCC from 4.6.3 to 4.7.2 +- - Upgrade libusbx from 1.0.10 to 1.0.14 +- - Upgrade jansson from 2.3.1 to 2.4 +- - Upgrade libcurl from 7.26.0 to 7.28.1 +- - Upgrade pthreads-win32 from 2.8.0 to 2.9.1 +- Bugfix: Release libudev handle when ID_MODEL doesn't match what we're looking +for +- openwrt: Script to build for multiple platforms easily +- openwrt: Bitstreams should be "all" arch +- Working OpenWrt Buildroot Makefile +- Do not enable the pool disable on reject feature unless explicitly enabled +with --disable-rejecting. +- Check for calloc failure for completeness in gen_stratum_work. +- Cache the coinbase length to speed up stratum work generation. +- Cache the header length when generating stratum work to avoid calculating it +on every work generation, and to only need one alloc+sprintf, speeding up work +generation. +- Use heap ram for coinbase in gen_stratum_work, zeroing it before use. +- Provide a wrapper for aligning lengths of size_t to 4 byte boundaries. +- Bugfix: ztex: While 1.15y can finish highspeed FPGA config immediately, at +least 1.15x needs some delay +- Use CURLOPT_OPENSOCKETFUNCTION to intercept the socket being created for +stratum, in order to workaround CURLINFO_LASTSOCKET breakage on Win64 +- make-release: Update for Win64 and bfgminer-rpc.exe +- Use localtime_r instead of localtime, including a Windows implementation that +handles Win64's broken struct timeval.tv_sec +- Use standard execv arg type on Win64 +- Bugfix: Correct various size mismatches +- Ensure winsock2.h is always included before windows.h +- Bugfix: Add necessary Winsock library to bfgminer-rpc linking +- Bugfix: Remove dependencies of compat.h on miner.h for Windows (moves +timersub/timeradd to compat.h where it belongs) +- modminer: Raise default/maximum clocks to 210 and 250 respectively +- modminer: Use better-performing X6500 overclocker bitstream +- Disable libusb linkage/usage when neither X6500 nor ZTEX support is desired +- Add support for "--scan-serial all" via simply globbing /dev +- fpgautils: serial_autodetect implementation using sysfs +- fpgautils: Unified serial_autodetect function to find a serial device +regardless of the underlying method +- fpgautils: Look for bitstreams in ../share/bfgminer/ too +- Bugfix: Ensure curses library is always linked in NCURSES_LIBS, to avoid +unnecessary dependencies for (non-curses) tools +- Bugfix: GBT: work->data is always little-endian, but libblkmaker wants the +nonce in native-endian +- Bugfix: cpu: Corrections necessary to get 'c' and 'cryptopp' algorithms +working on big endian +- Bugfix: Sanity check for bits exponent in real_block_target +- Bugfix: cpu: Increment nonce after checking (rather than before), to avoid +skipping the first nonce of each scanhash call +- cpu: via: Only swap back the nonce, rather than all data +- cpu: Minor optimization by checking H==0 before calling fulltest +- Bugfix: Skip yasm check when building for non-x86 platforms +- Allow --scantime alias to --scan-time +- Build bfgminer-rpc program from api-example.c +- Bugfix: Remove miner.h include from api-example.c since it isn't needed and +pulls in libblkmaker +- Make wrapping consistent at 79-80 characters per line +- Bugfix: Correct numerous misspellings, typos, etc +- Bugfix: Prefer using a non-frozen mining thread for watchdog +- Bugfix: x6500: Expose x6500_fpga_data even if JTAG reset/detect fail, since +it is still used to store temperature info if the other FPGA initializes +- Adding ZTEX Windows guide from Jason Snell + + +BFGMiner Version 2.10.3 - January 22, 2013 + +- Revert "x6500: Whenever we get a hardware error, purge buffers just in case +of read/write desync" +- Bugfix: libblkmaker: Check that zero-padding on base58check input matches +output (needed to properly reject addresses with too many or too few prefix/pad +'1's) +- Bugfix: Free bin2hex output in __update_block_title +- Bugfix: Allocate space for the terminating null byte on new current_hash +- Display tail end of prevblock hash rather than start+32bits +- Try to extract block height from coinbase scriptSig, when mining stratum +- Display next block height when using GBT +- Use suffixes for target-difficulty also, in share accept/reject loglines +- Bugfix: Implement common target_diff function, fixing scrypt-specific bugs in +and simplifying common code shared by set_blockdiff, calc_diff, and share_diff +- Set DISPLAY to :0 by default (on non-Windows) +- Bugfix: Reset pool bytes received when zeroing stats +- miner.php trim trailing zeros on some of the STATS numbers +- Semi-Cherrypick: API stats - include pool network bytes + in miner.php +- Best Share readme +- API zero - zero statistics - all or bestshare - with optional on screen +summary +- api.c pgaenable not re-enabling the device - plus related debug +- diffexactone pool diff1 used for share value calculation is ffffffff... not +100000000... :P +- miner.php user/pass fix 'usr' is readonly +- miner.php optional user/pass login restrictions +- zero (most) API stats +- Remember best share per pool and return in API pools +- ztex: precheck the secondary solutions to avoid hw errors the ztex bitstreams +gives back the latest checked nonce and its hash7 value and two possible +solutions. +- Bugfix: configure: if blocks require at least one command, so fill with true +- Bugfix: Only log stratum resume if it was actually "idle" before +- Zero the best share string memory when zeroing stats. +- Change the pool stratum socket buffer to new cgminer implementation, to +allocate it in a grow-only fashon and reduce virtual memory fragmentation at +the expense of CPU time. +- Differentiate socket full from sock full. +- Allow stratum to startup without notify but check it is valid before creating +stratum work. +- Do not try to generate stratum work unless the notify command has succeeded. +- Document Mac OS X configure usage with Homebrew pkg-config path +- Clean up post-configure display of compile environment +- Bugfix: If native ncurses detection fails, print "none?" result before moving +on to try AC_SEARCH_LIBS scan +- Fix more printf-format non-compatibilities +- Update windows-build.txt + + +BFGMiner Version 2.10.2 - December 27, 2012 + +- Update documentation to include block difficulty +- Reset all stats when requested +- Reset total diff1 shares when zeroing stats as well to show correct work +utility. +- Update documentation. +- Parse anything in the stratum socket if it's full without waiting. Empty the +socket even if a connection is not needed in case there are share returns. +- Provide a mechanism to zero all the statistics from the menu. +- Display the current pool diff in the status line. +- Display block diff in status line. +- Generalise the code for solving a block to enable block solve detection with +scrypt mining. +- Generate the output hash for scrypt as well and use the one function to set +share_diff. +- Use one size for scratchbuf as a macro in scrypt.c +- Remove the unused sha224 functions. +- Check staged_rollable under staged lock, when cloning available work. +- scrypt_diff uses a uint64_t as well. +- Correct target for stratum support with scrypt mining. +- Bugfix: Ensure nonces are put in data as little-endian in test_nonce* +- Add low-level debugging info for data_buffer (some only enabled with +-DDEBUG_DATABUF) +- Make all_data_cb fwrite-compliant by returning nmembs, and check for unlikely +overflows +- Bugfix: Need to do extract_sockaddr before trying to initiate stratum +(erroneous http URI usage, except at startup) +- Bugfix: Update last GBT work in pool_active before staging it, since otherwise +it could possibly be consumed before we copy it +- Bugfix: Address Windows-specific formatting issues (including lack of support +for %ll*) +- Bugfix: ztex: Correct formatting for reset failure error +- ztex: Fix formatting in a debug message +- cairnsmore: Don't bother timing dynclock detection, since there's no standard +way to log it accurately +- Correct formatting in FPGA drivers +- opencl/adl: Fix formatting to fit strict rules +- Explicitly cast all_data.buf to char* for debug printing +- Follow strict time_t handling rules +- Use GNU format-checking attribute when available for applog + + +BFGMiner Version 2.10.1 - December 21, 2012 + +- libztex: fixed a typo +- libztex: check returnvalue of libusb_claim_interface() and release the +interface in case of early exit +- Bugfix: submissions: Skip FD_ISSET when fd==-1 (let the next select setup deal +with cleaning them out) +- Bugfix: Remove sws from write_sws list when discarding it due to pre-send +stratum disconnection +- Bugfix: Shutdown stratum socket when initiate fails, so it doesn't linger +- Bugfix: Clear stratum receive buffer when initializing, in case there was +extra unprocessed data in it from a previous connection +- Stop all work from the current pool if it's a stratum pool once it is +disconnected since it will be invalid upon reconnecting. +- Discard all staged work from stratum pools as well as the shares upon +disconnection since all the work becomes invalid. +- Use correct cbreak after 15 second delay when no pool is found alive. +- modminer: Set default clock frequency to user request so it sticks better +- modminer: Make valid frequency range consistent: 2-230 +- Allow stratum to work with scrypt. +- MMQ add api pgaset for clock +- API V1.23 - new pgaset command, to be used soon +- Protect the best_share/best_diff values under control lock. +- Bugfix: modminer: Return failure to change frequency when device reports it +- opencl: Look in the right place for OpenCL library on Mac OS X +- Bugfix: AC_C_BIGENDIAN is reported to have problems, and invasive even if +buried in a conditional, so don't use it +- Bugfix: Check for bswap_* first, to avoid redefinition based on other variants +- Bugfix: autoheader isn't smart enough to figure out variable defines, so use +AH_TEMPLATE for each possible header +- Check a stratum pool hasn't gone dead while being a backup pool and missed +having its idle flag cleared. +- Fix null pointer issue when one chip on an X6500 is not initialized yet when +reading temperature. +- Hot-patch broken libcurl pkgconfig CFLAGS found in libcurl's Windows binaries +- Update OpenCL 1.2 headers from http://www.khronos.org/registry/cl/api/1.2/ +- Reorganize detection of platform byteswap macros and endian to be more robust +using autoconf +- Move new bandwidth-based Efficiency to status line +- Replace work-based efficiency with new bandwidth-based efficiency +- Bugfix: Pull out GBT request collapsing since it is no longer needed with new +get_work main loop +- Bugfix: Free unused work when waiting on external GBT request +- README: Explicitly mention automake dependency +- README: Update AMD APP SDK URIs +- Bugfix: Free shares discarded before beginning submission +- Bugfix: Discard stratum shares waiting for a writable socket, if the pool +disconnects in the meantime +- Bugfix: Always let watchpool thread handle dead pool recovery (including for +stratum-only pools) +- Bugfix: Avoid lingering stratum_auth when connection is lost +- API-README explain custom page extensions in miner.php +- miner.php add a sample group pool report +- miner.php allow where,group,having on cumstom pages +- Bugfix: Hook CURLOPT_DEBUGFUNCTION to count actual bytes sent/received by +libcurl +- Bugfix: Reset pool transparency_time when connecting to stratum +- Bugfix: Immediately discard shares found on disconnected stratum pools, since +there is no way to submit them +- Bugfix: Decrement total_submitting when stale shares are discarded before any +submission attempts +- Bugfix: Only try to compare stratum job_id for work that has a job_id (ie, +ones that came from stratum) +- Bugfix: Recheck has_stratum even if the pool hasn't changed, in case pool has +switched to another protocol in the process; also only delay 5 seconds before +retry if pool is the same +- Bugfix: Try GBT if no pool protocol is known (can occur in the process of +stratum failover to GBT) +- Bugfix: Correctly track discarded stratum shares, and log them as "disconnect" +in sharelog +- Check for EWOULDBLOCK when supported in send and recv as well. +- Use the raw send() command instead of curl_easy_send since curl raw socket +usage introduces random bugs on windows. +- Use raw recv() command in place of curl_easy_recv since the curl +implementation introduces random bugs on windows builds when the recv fails. +- miner.php when displaying a single rig, add prev/next rig buttons if they +exist, next to refresh +- miner.php allow custom page joins for STATS +- miner.php - include windows easyphp link +- driver-ztex: use the correct size for the swap array +- API stats - display pool byte transfer stats +- Pool store data transfer stats +- Benchmark incorrect work size +- ChangeLog refer to NEWS +- driver-ztex: search the complete noncerange based on the actual speed +- API-README update +- api use a dynamic io buffer, truncated before it reaches the current ~64k +limit + + +BFGMiner Version 2.10.0 - December 11, 2012 + +- Bugfix: Free work before replacing it with clone +- Bugfix: Since we are using pipes for select notifier on *nix, we need to use +read/write there +- Bugfix: Winsock needs send/recv for sockets, not write/read +- Bugfix: opencl: Initialize pc_data to avoid clean_work checking uninitialized +pointers +- Bugfix: Correct parenthesis in bind() call in Windows notifier_init +- Include Windows error messages in notifier_init errors +- Include prctl header for thread renaming to work. +- Set tv_idle time if a pool is not active when input from the menu. +- minor unlikely zero pointer test +- BeaverCreek doesn't like BFI INT patching. +- Only stratum pools that are idle need to be kicked via cnx_needed. +- Do not do any setup if opt_api_listen is disabled in api.c. +- libztex: in case the selectFpga() failed set the selected fpga to unknown +- Only set the lagging flag for select_pool() on failed getwork if we're not in +opt_fail_only mode. +- driver-ztex: support for broken fpga on a multifpga board +- libztex: use a function for the twice called firmware reset code +- libztex: removed an unused struct member (ztex->valid) +- Set the pool lagging flag on startup to avoid it being shown initially, and +only unset it once the maximum number of staged work items has been reached. +- libztex: Include compat.h for substitute libusb_error_name (on older libusb +versions missing it) +- Suppress warning about "succeeded" not being used in finish_req_in_progress +for now +- Bugfix: Always give the get_work thread a curl, regardless of other +outstanding curls in use +- Bugfix: Failover after even a single job-request failure (or else it takes +too long on timeouts) +- Bugfix: Need to remove and re-add curl easy handles from multi to start a new +request +- Access total_submitting under mutex lock to avoid any potential races, and +increment it as soon as we queue the submission up +- Just leave the submit_work thread running persistently +- Bugfix: Restore work->pool after prepare_rpc_req since clean_work now clears +it +- Bugfix: Now that stage_work is trying to manipulate staged_work in the same +thread, clone_available needs to stage it outside of its own lock +- Make main() the getwork scheduler once everything is set up, so that all app +exits use the kill_work and quit paths. +- Set successful connect to true on auth stratum to allow summary on exit from +single stratum pool. +- Hash_pop should signal further waiters on its own pthread conditional in case +there are multiple waiters. +- Check the job_id has not changed on stratum work when deciding if the work is +stale as might occur across disconnections. +- Perform pool_resus on getwork pool that generates work in getwork_thread. +- Set pool lagging message for getwork pool that falls to zero staged in getwork +thread. +- Stage extra work when the primary pool is a getwork pool without rolltime. +- Do not try to clean up twice if kill message is given. +- Only recalculate total_staged in getwork thread if required. +- Include the correct config header in libztex and include it before other +includes. +- Implement a completely new getwork scheduler. Stage all work from the one +thread, making it possible to serialise all requests minimising the number of +getworks requested or local work generated. Use a pthread conditional to wake up +the thread whenever work is removed to generate enough work to stay above the +watermark set by opt_queue. Remove all remnants of the old queueing mechanism, +deleting the now defunct queued count. +- Bugfix: Clean up share hashing and target checks, fixing share difficulty +calculation for above-target would-be-shares +- Use templates from pool_active and longpolls without fetching more +unnecessarily +- Try to avoid requesting GBT jobs when there is already a request in progress +that will likely provide sufficient work +- Reuse most recent GBT job if in get_work_thread if it isn't stale +- libztex: fixed some warnings and removed some whitespaces +- Remove all references to the now unused workio_cmd structure. +- Remove the old workio command queue thread, replacing it with a kill +conditional to exit the program. +- Remove getwork command from workio_cmd queues and do them directly from +queue_request. +- Begin tearing down the old workio command queues by removing submit commands +from there and submit them asynchronously via their own threads. +- driver-ztex: changed two pairs of malloc()/memset() to calloc() +- libztex: Read bitstream file in 2kb blocks with simpler and faster code +- Added the binary versions of ztex_ufm1_15d4.ihx and ztex_ufm1_15y1.ihx +- libztex: Add firmware download support for ZTEX 1.15d and 1.15x +- libztex: Factor out local version of libusb_get_string_descriptor_ascii() +- libztex: Don't return error when a bitstream was already configured +- libztex: Read bitstream file in 64kb blocks with simpler and faster code +- libztex: Verify that the mining firmware is not a dummy firmware +- libztex: Match mining firmware ZTEX descriptor against the dummy firmware +- libztex: Start download sequence only after reading in the new firmware +- libztex: Download mining firmware to all devices with dummy firmware +- Update windows build instructions. +- Set pool probed to true on successful authorisation with stratum to avoid it +being pinged later. +- Style changes. +- Allow pool active to be called on stratum or disabled pools in the watchpool +thread if the pool has not been probed. +- lock (most of) the threaded statistics updates +- README stats don't add up +- Rearrange summary lines and include count of active submissions in progress +- Defer submissions instead of blocking in pop_curl_entry +- Run a single share submission thread asynchronously submitting all shares in +parallel +- Handle share submissions asynchronously, one at a time (still threaded) +- Split up json_rpc_call so it can be used asynchronously in libcurl-multi +- Split submit_upstream_work into _request and _completed stages, pulling out +json_rpc_call +- Bugfix: Adjust USB_* variables to new LIBUSB_* names +- Bugfix: Avoid double-free due to realloc_strcat moving memory around +- Bugfix: Stratum connections might be needed for share submissions up to a +minute after the last time they are used to generate work +- Bugfix: Clean work before trying to generate new stratum work on top of it +- Bugfix: modminer: Get rid of useless usbutils include +- Make need connection return true if a pool is idle. +- New --skip-security-checks option to allow miners to skip checks when it +saves bandwidth +- Skip stratum transaction download when there are no transactions +- API add Best Share to summary +- API lock access to some summary statistics (and copy them) +- Enable backup stratum connections for getwork when the primary pool doesn't +have longpoll aka solo mining. +- Check for correct absence of opt_fail_only in cnx_needed. +- Remove unused variable. +- The specification for stratum has been elaborated to say that a changed diff +applies only to new work so do not retarget when submitting shares. +- Suspend stratum connections to backup pools when there is no requirement to +potentially grab work from them. +- Rename rename_thr to RenameThread to match cgminer +- modminer: Adopt symbolic command names from kanoi +- Make gen_stratum_work more robust by using a dynamically allocated array for +the header in case bogus data is sent by the pool to avoid overflowing a static +array. +- scrypt_diff now returns a uint64_t +- Support monitoring and reporting much higher diffs for scrypt mining, +truncating irrelevant zeroes from displayed hash. +- Pass ostate values around in scrypt to be able to extract full hashes if +needed later on. +- Revert "Handle crash exceptions by trying to restart cgminer unless the +--no-restart option is used." +- Provide helper function realloc_strcat to extend arbitrary length arrays +based on string length. +- Use base_work for comparison just for cleanness in __copy_work +- Remove all static work structs, using the make and free functions. +- Add pool no. to stale share detected message. +- Add info about which pool share became stale while resubmitting. +- Reduce extra slots in the max backlog for ztex to minimise memory waste. +- Get rid of unused last_work in opencl thread data. +- Do away with the flaky free_work api in the driver code which would often lose +the work data in opencl and simply flush it before exiting the opencl scanhash. +- Minor work handling restructure, including moving some stratum data from +fixed-size buffers to their own heap allocations. +- opencl: Use new dev_error function for REASON_DEV_NOSTART +- Provide rudimentary support for the balancing failover strategies with stratum +and GBT by switching pools silently on getwork requests. +- Convert remaining modminer and bfl uses of usleep to nmsleep. +- Convert libztex to nmsleep where possible. +- Convert unreliable usleep calls to nmsleep calls in ztex driver. +- Tidy up device error counts +- Only increase gpu engine speed by a larger step if the temperature is below +hysteresis instead of increasing it to max speed. +- Convert pool not responding and pool alive message on backup pools to verbose +level only since they mean a single failed getwork. +- Use stratum block change from backup pools as an alternative to longpoll for +pools that don't support LP. +- Round some more static string arrays to 4 byte boundaries. +- There is no need for the static arrays to be larger than required, so long as +they're 4 byte aligned to appease ARM. +- Hash1 is only used by the CPU mining code and never changes so remove it from +the work struct and bypass needing to process the value for all other mining. + + +BFGMiner Version 2.9.5 - December 11, 2012 + +- Bugfix: Copy share hash to work->hash before doing 4-byte flip required by +fulltest +- driver-ztex: libztex_setFreq() must be called before ztex_releaseFpga() +- libztex: Make log messages say bitstream when refering to bitstreams +- Increase FD_SETSIZE to 4096 on Windows +- Bugfix: Use AC_PROG_CPP in libusb include subdirectory detection for improved +portability +- Bugfix: Free input memory after prioritising pools in TUI +- Bugfix: Free filename entry for writing config file when done with it +- Bugfix: Free stratum nonce1 before replacing it with new value on reconnect + + +BFGMiner Version 2.9.4 - December 4, 2012 + +- Update libblkmaker to 0.2.1 +- Count template number, and append it to the coinbase of templates without any +cbtxn +- Bugfix: bitforce: Always increment global hw error counter when incrementing +device hwe +- Bugfix: Correct order of printf-style arguments in cbappend fail +- Bugfix: Capitalize "MHz" correctly +- ztex: Correctly release mutex and reset FPGA if configuration fails +- ztex: Harmonize low-speed FPGA configuration code with high-speed code +- libztex: Silence warning: comparison between signed and unsigned +- Count longpoll decodes as queued work since the count otherwise remains +static. +- Bugfix: Assign header-based rolltime before decoding work, so GBT expires +overrides it properly +- Look for libusb_init in -lusb, since FreeBSD has it there +- Bugfix: Use pkgconfig for libusb when available, and try to guess the include +path if not +- Bugfix: FPGA-README: Correct idVendor in example MMQ udev rule +- fixes target calc for mips openwrt +- Bugfix: clear_work: Whether the template is in fact being freed or not, the +work reference to it needs to be +- libztex: Work around ZTEX USB firmware bug exposed by the FreeBSD libusb +- README: Document solo mining usage +- README: Update dependencies +- Bugfix: We should never roll stale work +- Ubuntu: Removing erroneous libssl dep again. GITHUB#94 +- Bugfix: Clear out stratum share work before freeing it +- Provide rudimentary support for literal ipv6 addresses when parsing stratum +URLs. +- Do not attempt to remove the stratum share hash after unsuccessful submission +since it may already be removed by clear_stratum_shares. + + +BFGMiner Version 2.9.3 - November 16, 2012 + +- Bugfix: Properly process new stratum jobs through test_work_current, even if +old shares are still accepted, and copy submit_old flag correctly +- Ensure pdiff 1 is always caught regardless of bdiff precision, and ceil all +other cases to ensure we never lose valid shares +- Check against a double for current pool diff. +- Support for fractional diffs and the classic just-below-1 share all FFs diff +target. +- Check share target diff for best_share to be calculated when solo mining. +- Store the full stratum url information in rpc_url for correct configuration +file saving. +- Put in a hack to prevent dud work from sneaking into test_work_current being +seen as a new block. +- Reset the work->longpoll flag where it will affect stratum work items as +well. +- Bugfix: Stratum does not guarantee notify messages every minute, so extend +timeout to 2 full minutes +- Bugfix: Always honour libblkmaker time limits +- Always (debug)log when stratum template is updated by the pool +- Bugfix: When a stratum connection is interrupted, ensure all work/shares for +it are considered stale +- Bugfix: clear_sock should return on socket errors +- Bugfix: Force calculation of work_difficulty since set_work_target fails to +consider the pdiff1000. +- Get rid of unused warning for !scrypt. +- Use select on stratum send to make sure the socket is writeable. +- Cope with dval being zero in suffix_string and display a single decimal place +when significant digits is not specified but the value is greater than 1000. +- Pad out the suffix string function with zeroes on the right. +- Failure to calloc in bin2hex is a fatal failure always so just check for that +failure within the function and abort, simplifying the rest of the code. +- Provide locking around the change of the stratum curl structures to avoid +possible races. +- Bump opencl kernel version numbers. +- Remove atomic ops from opencl kernels given rarity of more than once nonce on +the same wavefront and the potential increased ramspeed requirements to use the +atomics. +- Clear the pool idle flag in stratum when it comes back to life. +- Display correct share hash and share difficulty with scrypt mining. +- Show work target diff for scrypt mining. +- Watch for buffer overflows on receiving data into the socket buffer. +- Dramatically simplify the dynamic intensity calculation by oversampling many +runs through the opencl kernel till we're likely well within the timer +resolution on windows. +- Align static arrays to 4 byte boundaries to appease ARM builds for stratum. +- Update documentation. +- Left align values that are suffix_string generated. +- Share_diff should not be converting the work data to hex. +- Update readme describing difficulty displayed on log lines. +- Off by one error. +- Prevent overflows of the port char array in extract_sockaddr. +- Disable stratum detection with scrypt. +- Display the actual share diff next to the pool required diff, using a suffix +creation function to prevent values of >1000 being shown in their entirety. +- Fix 4 * 0 being 0 that would break dynamic intensity mode. +- Supplement other 64-bit endian swap macros +- Bugfix: Fix htobe64 on big endian platforms that don't define it +- Fix lack of htobe64 on mingw32. +- Reinstate the history on dynamic intensity mode to damp fluctuations in +intensity but use an upper limit on how much the value can increase at any time +to cope with rare overflows. +- Update to cgminer's newer dynamic intensity algorithm +- Support for the stratum mining protocol. +- Simplify target generation code. +- Add support for client.get_version for stratum. +- Use a 64 bit unsigned integer on the diff target to generate the hex target. +- Update reconnect message to show whole address including port. +- Look for null values and parse correct separate array entries for url and port +with client reconnect commands for stratum. +- The command for stratum is client.reconnect, not mining.reconnect. +- Only copy the stratum url to the rpc url if an rpc url does not exist. +- Implement rudimentary mining.reconnect support for stratum. +- Ignore the value of stratum_active on calling initiate_stratum and assume +we're always trying to reinitiate it, and set the active flag to false in that +function. +- stratum auth can be unset if we fail to authorise on subsequent calls to +auth_stratum which undoes the requirement of setting it in one place so set it +in pool_active. +- Format Stratum submission-start debug the same way as other submissions +- Bugfix: Set work_restart_id in gen_stratum_work for when work is reused to +avoid thinking it's all stale. +- Only auto-switch to Stratum internally, but save HTTP URI in case pool stops +using Stratum; also always shows original pool URI on RPC +- SHUT_RDWR is now always defined for us, so no need to check ifdef on LP hang +- Implement --no-stratum option to disable autodetection +- Show Stratum pools as "Strtm" protocol in "Pool management" TUI +- Bugfix: BFGMiner doesn't use rpc_proxytype +- Remove free that could segfault. +- Use the stratum url as the rpc url advertised if we switch to it. +- Count an invalid nonce count as a hardware error on opencl. +- Count each stratum work item as local work. +- Cope with one stratum pool being the only active pool when it dies by sleeping +for 5 seconds before retrying to get work from it instead of getting work +indefinitely. +- Detect stratum outage based on either select timing out or receiving an empty +buffer and properly re-establish connection by disabling the stratum_active +flag, coping with empty buffers in parse_stratum. +- Fix various modminer warnings on mingw. +- Fix sign warning on windows build for bitforce. +- Cast socketfail to integer since SOCKET is an unsigned int on windows. +- Use the stratum thread to detect when a stratum pool has died based on no +message for 2 minutes. +- Only set the stratum auth flag once and once the stratum thread is started, +use that to set/unset the stratum active flag. +- Only hand off to stratum from getwork if we succeed in initiating the +protocol. +- Target should only be 32 bytes copied. +- Use a static array for work submission data instead of stack memory. +- Clear the buffer data before sprinting to it. +- Clear work stratum strings before setting them and add them to debug output. +- Drop stratum connect failed message to verbose level only since it's a regular +probing message. +- TCP Keepalive in curl is only in very recent versions and not required with +regular messages on stratum anyway. +- Move stratum sockets to curl infrastructure with locking around send+recv to +begin support for proxies and ssl. +- Make detect stratum fail if a proxy has been set up. +- Stratum does not currently have any proxy support so do not try to switch to +stratum if a proxy has been specified. +- Windows doesn't work with MSG_PEEK on recv so move to a continuously updating +buffer for incoming messages. +- Alloca is unreliable on windows so use static arrays in util.c stratum code. +- Begin support for mingw stratum build. +- Add space to reject reason. +- Parse the reject reason where possible from stratum share submission. +- Pass json error value to share result function to be able to parse reject +reason in stratum. +- Don't try to parse unneeded parameters in response to mining.subscribe. +- Remove the sshare hash entry if we failed to send it. +- Change notify message to info level to avoid spamming repeatedly when a pool +is down. +- Check the stratum pool difference has not changed compared to the work diff +when testing whether a share meets the target or not and retarget if necessary. +- Bit error in target calculation for stratum. +- Offset the current block detection to the prev block hash. +- We should be testing for id_val, not id in parse stratum response. +- Make target on stratum scale to any size by clearing sequential bits according +to diff. +- Correct target calculation in gen_stratum_work. +- If a share result has an error code but still has an id, it is likely a +reject, not an error. +- Initiate stratum the first time in pool_active only, allowing us to switch to +it on getting a failed getwork and detecting the presence of stratum on the url +at that time. +- Use 5 second timeout on sock full for now as a temporary workaround. +- If no stratum url is set by the end of the detect stratum routine, copy the +sockaddr url. +- Make all buffers slightly larger to prevent overflow. +- Make the stratum recv buffer larger than the recvsize. +- Userpass needs to be copied to user and pass earlier to allow stratum +authorisation to work with it. +- Store a sockaddr url of the stripped url used in determining sockaddr to not +confuse it with the stratum url and fix build warnings. +- Decrease the queued count with stratum work once it's staged as well. +- Allow the stratum retry to initiate and auth stratum in pool_alive to make +sure the stratum thread is started. +- Avoid duplicating pool->rpc_url and setting pool->stratum_url twice to itself. +- Detect if a getwork based pool has the X-Stratum header on startup, and if so, +switch to the stratum based pool. +- Comment update. +- Minor message change. +- Create a work item from a "clean" request from stratum allowing the new block +to be detected and the appropriate block change message to be given. +- Use statically allocated stratum strings in struct work to cope with the +inability to safely deallocate dynamically allocated ram. +- Use the current pool when deciding whether to reuse work from a stratum source +rather than the work's previous pool. +- Copy the stratum url to the rpc url to avoid none being set. +- Provide locking around stratum send operations to avoid races. +- Submit shares from stratum through the abstracted submit share function +detecting what message they belong to and showing the data from the associated +work, and then deleting it from the hash. +- Use a more robust mechanism to obtain a \n terminated string over a socket. +- Abstract out share submit as a function to be useable by stratum. +- Rename parse_stratum to parse_method as it is only for stratum messages that +contain methods. +- Display stratum as mechanism in status line when current pool is running it. +- Count each stratum notify as a getwork equivalent. +- Correct nonce submitted with share. +- Extranonce2 should be added before coinbase2. +- We should be hashing the binary coinbase, not the hex one. +- Fix endianness of nonce submitted for stratum. +- Check that stratum is already active in initiate_stratum to avoid +de-authorising ourselves by subscribing again. +- Begin implementing a hash database of submissions and attempt sending results. +- Copy parameters from stratum work required for share submission. +- Set lagging flag on first adding a pool to prevent pool slow warning at +startup. +- Fix work->target being a 32 byte binary in gen_stratum_work. +- Store and display stripped url in its own variable. +- Create machinery to divert work requests to stratum. +- Generate the work target in gen_stratum_work, setting default diff to 1 in +case it is not yet set. +- Generate work data, midstate and hash1 in gen_stratum_work. +- Generate header created from stratum structures in gen_stratum_work. +- Generate merkle root hash in gen_stratum_work. +- Generate the coinbase for generation of stratum based work. +- The number of transactions is variable so make merkle a variable length +dynamically allocated array and track how many there are for stratum. +- Rename nonce2 to n2size reflecting that it's a size variable and not the +actual nonce. +- Provide rudimentary support for stratum clean work command in the stratum +thread. +- Cope with pools being removed in the stratum thread. +- Use the pool sock value directly in the stratum thread in case it changes +after reconnecting. +- Create a stratum thread per pool that has stratum that monitors the socket and +serves received data. +- Check return value of stratum_parse. +- Complete authorisation in stratum. +- Implement stratum parsing of notify parameters and storing them in the pool +stratum work structure. +- Create helper functions for duplicating json strings to avoid keeping json +references in use. +- Append \n in the sock_send function instead of adding it when constructing +json in stratum. +- Don't keep any json references around with stratum structures. +- Create parse_stratum function that hands off stratum parameters to other +functions to manage pool stratum work struct variables. Implement mining +difficulty setting. +- Create helper functions for checking when a socket is ready to read on and +receive a single line at a time. Begin stratum authorisation process. +- Provide a helper function for reading a single \n terminated string from a +socket. +- Create a stratum work structure to store current work variables. +- Test specifically for stratum being active in pool_active. +- Detect stratum in common place when adding urls, and use a bool to tell us +when it's active. +- Remove unused add_pool_details5 +- Fix warnings. +- Extract and store various parameters on stratum init confirming successful +mining notify. +- Use existing socket macros and close the socket on failure in init stratum. +- Initiate stratum and grab first json result. +- Get detailed addressinfo from the parsed URL for future raw socket usage when +possible. IPV4 only for now. +- Prepare for getaddrinfo call. +- Add data structures to pool struct for socket communications. +- Put all socket definitions in util.h to allow reusing by added socket +functions to be used in util.c. + + +BFGMiner Version 2.8.3 - October 18, 2012 + +- Update to libblkmaker 0.1.3 +- Use explicit host to BE functions in scrypt code instead of hard coding +byteswap everywhere. +- Ease the checking on allocation of padbuffer8 in the hope it works partially +anyway on an apparently failed call. +- Round target difficulties down to be in keeping with the rounding of detected +share difficulties. +- String alignment to 4 byte boundaries and optimisations for bin<->hex +conversions. +- Fix GPU memory allocation size for scrypt +- Fix access violation with scrypt mining +- Bugfix: Only free rpc_req after using it, not before +- Bugfix: Increment work->pool->staged inside of mutex to avoid work being +freed (and staged decremented) before we dereference it +- Revert "No need for extra variable in hash_push.": The extra variable is +needed to avoid a rare dereference-after-free error. +- In opencl_free_work, make sure to still flush results in dynamic mode. +- Workaround: Debug log only after dec_queued, to make a free/use race more +rare +- Bugfix: Remove redundant \n in debug messages +- Bugfix: Free rpc_req in pool_active and longpolls +- README: Explicitly provide Ubuntu package name for libjansson-dev +- Bugfix: Include flash_led bool in cgpu_info for Icarus-but-not-BitForce +builds, since Cairnsmore uses it +- Only check work block id against pool's if the pool has a known block id +- Avoid clearing pool->block_id unless we really are changing pools + + +BFGMiner Version 2.8.2 - October 8, 2012 + +- Update to libblkmaker 0.1.2 +- Bugfix: --temp-target no longer has a simple default (fixes build without +OpenCL support) +- Bugfix: icarus: Silence false epoll error +- Bugfix: icarus: Set firstrun for errors starting next job, so the current +one finishes properly +- Bugfix: icarus: Restore generic failure management for write errors +- Use strtod not strtol for bitforce temp backup. +- Cope with broken drivers returning nonsense values for bitforce temperatures. +- Minor warning fixes. +- Fix unused warnings on ming build. +- Fix sign warning in ocl.c +- fds need to be zeroed before set in modminer. +- Put scrypt warning on separate line to avoid 0 being shown on windows as +bufsize. +- Prevent corrupt values returned from the opencl code from trying to read +beyond the end of the buffer by masking the value to a max of 15. +- Icarus USB write failure is also a comms error +- api.c DEBUG message has no paramter +- Icarus catch more USB errors and close/reopen the port +- API-README update cgminer verison number +- hashmeter fix stats kh/s on 32bit windows +- cairnsmore: Increase maximum clock frequency to 210 Mhz +- icarus: Hashrate estimates really don't need the attention of a warning, +demote them to debug +- cairnsmore: Automatically "downgrade" default FPGA-per-device to 1 for +dynclock devices +- Bugfix: cairnsmore: Get autodetection of dynclock to work consistently +- cairnsmore: Adjust dynclock usage to react in proper time +- dynclock: Document function usage +- cairnsmore: Fix race on dynclock detection +- icarus: Detect attempts to send commands via work and neuter them +- cairnsmore: Glasswalker has a minimum multiplier of 20 :( +- cairnsmore: Detect frequency changing support despite hashing of commands +- modminer: Allow clocks down to 2 Mhz just in case +- Allow device drivers and users to properly change target temperatures for +non-GPUs +- Check that ncurses*-config installs actually work before deciding to use +them +- Bugfix: Fix multiple bugs in autogen.sh +- - Don't use readlink -f unneccesarily (it's not portable) +- - Always run autoreconf within the real source directory +- - Run configure from PWD, *not* the real source directory +- Bugfix: Include nonce in data buffer for debugging +- Bugfix: swap32* wants count of 32-bit blocks, not bytes +- Initial Cygwin port +- Revert "Remove needless roundl define.", since it is needed for Cygwin and +OpenWRT +- Bugfix: Deal with various compiler warnings +- modminer: Implement --temp-hysteresis logic +- Support for maximum frequency being below the default, eg when the maximum +is temporarily reduced to deal with temperature +- Bugfix: modminer: Reduce dynclock max frequency as needed to keep +temperature below cutoff +- Bugfix: Restore disabled label, needed to skip over hashrate calculations +(which mess up otherwise) +- Bugfix: bitforce: Count actual throttling as hardware errors +- icarus: Allow failure in case of reopen failure, now that the miner core +will retry on its own +- If a device dies, attempt to reinitialize it occasionally +- Bugfix: The REST flag is now preferred over WAIT, since the former might +trigger the latter +- Bugfix: modminer: Update temperature readings when disabled (fixes thermal +cutoff recovery) +- Bugfix: Move thermal cutoff to general watchdog code (fixes bitforce +recovery) +- Rename enable_device to register_device, since it only works for setting it +up at startup +- Move targettemp from ADL to cgpu_info, so all devices can readily use it +- Bugfix: "REST" flag had too much padding +- Bugfix: adl: Only warn and disable GPU due to thermal cutoff, if it's +actually enabled +- Bugfix: bitforce: Only warn and disable bitforce due to thermal cutoff, if +it's actually enabled + + +BFGMiner Version 2.8.1 - September 27, 2012 + +- Avoid strndup for Windows compatibility +- Bugfix: cairnsmore: Add missing compat.h include (for sleep) +- cairnsmore: Implement "identify" for supported firmware +- Adjust identify_device API to return a bool whether supported or not, for +runtime capability detection +- Bugfix: cairnsmore: Fix invalid share detection on LE +- Bugfix: icarus: Fix logging message to not assume "Icarus" always, and use +device driver name +- Bugfix: cairnsmore: Correct frequency scaling detection logic +- cairnsmore: When changing frequency, adjust Hs expectations accordingly +- cairnsmore: Detect availability of frequency scaling, and only enable it +when supported +- cairnsmore: Implement dynamic clocking support for Glasswalker's bitstream +- Update libblkmaker to 0.1.1 +- Advertise BFGMiner in blocks found by default (without --coinbase-sig) +- RPC: Add "Coinbase-Sig" to config/setconfig +- New --coinbase-sig option to add arbitrary data to blocks you generate (GBT +only) +- opencl: Defer nonce validity checking to submit_nonce +- scrypt: Implement test_nonce2 and submit_nonce hw error check +- Bugfix: modminer: Convert nonce to native endian +- Interpret any attempts to submit a H-not-zero nonce as a hardware error +- make-release: Strip DLLs and EXE in Windows binary +- dynclock: Use consistent messages for frequency changes +- modminer: Port to dynclock +- dynclock: Split dynamic clocking algorithm out of Ztex driver +- Bugfix: When changing GPU memclock, adjust internal variable so it is +correctly saved to config file +- Bugfix: Re-probe longpoll header for each pool alive check, including +retries when a preferred protocol fails +- Bugfix: modminer: Bitstream binary filenames are *.bit +- modminer: Start frequency off at 200 Mhz +- Reorder libztex header include order to fix missing struct definition. +- Display share difficulty on log with a shortened hash display on submission. +- API stats add some pool getwork difficulty stats +- Ignore any pings pushed to the worker threads if the thread is still paused to +prevent it being enabled and disabled repeatedly. +- Test for sequential getwork failures on a pool that might actually be up but +failing to deliver work as we may end up hammering it repeatedly by mistake. +- reduce windows compile warnings +- util.c - bug - proxy - no data end condition +- API don't change 'Diff1 Shares' - backward compatability FTW +- miner.php highlighting correctly handling difficulty +- API - Add last share difficulty for devices and pool +- Store and report Accepted,Rejected,Stale difficulty in the summary and API +- WorkTime - display prevblock for scrypt +- api.c remove compile warnings +- Calculate work difficulty for each getwork and display with WorkTime debug +- FPGA - allow long or short device names in detect code + style police +- WorkTime - multiple nonce per work and identify the work source +- Optional WorkTime details with each Accepted/Rejected work item +- Icarus - ignore hardware errors in timing mode +- miner.php oops - mistype +- API pgaidentify - unsupported message should be a warning +- API/BFL identify a device - currently only BFL to flash the led +- BFL add throttle count to internal stats + API +- BFL: missing device id in log message +- Bugfix: ztex: Clear device_ztex before freeing it +- Bugfix: ztex: statline existence depends on whether the libztex structure +exists, not whether the cgpu is enabled +- Bugfix: README: Make usermod commands consistent, including important -a +option +- Bugfix: Address a couple of rare TQ leaks, and improve logging a bit +- Bugfix: Properly quote configure options + + +BFGMiner Version 2.8.0 - September 15, 2012 + +- Be specific about jansson version requirement +- Replace "Alive" in pool status with protocol in use (GBT or GWork) +- Remove copy of old jansson from source repository +- Honour block template expiry (BIP 23 Basic Pool Extensions "expires") +- Add --no-gbt option so getblocktemplate can be disabled if it causes +problems +- BIP 22 long polling +- Properly detect pool protocol +- Bugfix: Sort out work template refcounting by properly using work_free and +new workcpy +- Support for rolling extranonce in templates +- Initial libblkmaker integration, using a git submodule +- cairnsmore: There's no set hashrate like Icarus, so always use short timing +mode by default +- Bugfix: Include unistd.h needed for ssize_t type +- fpgautils: Don't try to scan serial at all anymore, if a device is claimed +- fpgautils: serial_claim function to politely ask other drivers not to try to +use device +- RPC: Update to work with Cairnsmore +- cairnsmore: Windows autodetect using FTDI library +- cairnsmore: Beginnings of new driver, with automatic upgrade from Icarus +detection +- icarus: Support disabling reopen quirk via --icarus-options +- proxy: Replace mess of encoding proxy into pool URI with a --pool-proxy +option, and use cURL's builtin proxy URI support +- save individual pool proxy settings to config +- API-README update for pools proxy info +- CURL support for individual proxy per pool and all proxy types +- Bugfix: Update current_block_id for fixed set_curblock +- miner.php by default don't display IP/Port numbers in error messages +- api.c all STATUS messages automatically escaped +- API add display of and setting queue,scantime,expiry +- README - FPGA device FAQ +- API add device diff1 work +- count device diff1 shares +- API-README update +- api.c Correct diff1 field name +- Bugfix: Sanitize block hash handling (including fixing on big endian) +- Bugfix: Print the (full) correct block hash when warning about work issued +against old blocks +- Bugfix: When comparing current block, only pay attention to the prevblock +header +- Allow mixing user+pass and userpass, so long as user+pass are balanced +before userpass options +- ztex: Include device serial number and FPGA number in cgpu name field +- ztex: Abstract common cgpu_info creation code +- ztex: Do thread initialization in thread_init rather than thread_prepare +- Bugfix: Tolerate working on old blocks when there is only one pool enabled +- Bugfix: ztex: Detect through fpgautils so -S noauto correctly inhibits +autodetection +- ztex: Workaround duplicate share submissions by doubling "backlog" size +- ztex: Use consistent device ids for logging +- Bugfix: ztex: Increment global hw_errors too +- Bugfix: free adhoc string elist element when removing it from list +- Bugfix: icarus: Initialize lret variable after work restart reentry +- Bugfix: ztex: Free lastnonce heap memory if backlog allocation fails +- icarus: Initialize epoll event structure in a way Valgrind is happier with +- Bugfix: Use strtok_r for parse_config since some options use strtok +themselves +- Import strtok_r from gnulib for Windows portability +- Bugfix: ztex: Don't try to destroy a mutex that was never created (single +FPGA Ztex devices) +- ztex: Clean up redundant dereferencing in ztex_shutdown +- API-README more debug parameter information +- API allow full debug settings control +- Sort the blocks database in reverse order, allowing us to remove the first +block without iterating over them. Output the block number to debug. +- Adjust opencl intensity when adjusting thread count to prevent it getting +pegged at a value below the minimum threads possible. +- miner.h max_hashes -> int64_t +- Keep the local block number in the blocks structs stored and sort them by +number to guarantee we delete the oldest when ageing the block struct entries. +- Use correct sdk version detection for SDK 2.7 +- Bugfix: Align Ztex statline properly by removing redundant frequency +- make-release: Convert text files to DOS format for Windows ZIP + + +BFGMiner Version 2.7.5 - August 27, 2012 + +- Revert "Do a complete cgminer restart if the ATI Display Library fails, as +it does on windows after running for some time, when fanspeed reporting +fails." +- Stop special-casing worksize default to 256 for Cypress, since it incurs a 5 +MH/s hit with stock config +- New "--scan-serial all" feature to probe all enumerated serial ports +- modminer: Revamp dynamic clocking algorithm per request from cablepair +- Test for lagging once more in queue_request to enable work to leak to backup +pools. +- There is no need to try to switch pools in select_pool since the current pool +is actually not affected by the choice of pool to get work from. +- Only clear the pool lagging flag if we're staging work faster than we're using +it. +- needed flag is currently always false in queue_request. Remove it for now. +- thr is always NULL going into queue_request now. +- Fix for non-ADL OpenCL device formatting issue + + +BFGMiner Version 2.7.4 - August 23, 2012 + +- Perform select_pool even when not lagging to allow it to switch back if needed +to the primary. +- Simplify macros in output kernels avoiding apparent loops and local variables. +- Carry the needed bool over the work command queue. +- Move the decision to queue further work upstream before threads are spawned +based on fine grained per-pool stats and increment the queued count immediately. +- Track queued and staged per pool once again for future use. +- OpenCL 1.0 does not have native atomic_add and extremely slow support with +atom_add so detect opencl1.0 and use a non-atomic workaround. +- Pools: add RollTime info to API 'stats' and 'Stats' button in miner.php + + +BFGMiner Version 2.7.3 - August 23, 2012 + +- Minimise the number of getwork threads we generate. +- Pick worksize 256 with Cypress if none is specified. +- Give warning with sdk2.7 and phatk as well. +- Whitelist sdk2.7 for diablo kernel as well. +- Only keep the last 6 blocks in the uthash database to keep memory usage +constant. Storing more is unhelpful anyway. +- Increase kernel versions signifying changed APIs. +- BFL flash - more FPGA-README +- Check we haven't staged work while waiting for a curl entry before proceeding. +- Use atomic ops to never miss a nonce on opencl kernels, including nonce==0, +also allowing us to make the output buffer smaller. +- Remove compile errors/warnings and document compile/usage in FPGA-README +- Ignore the submit_fail flag when deciding whether to recruit more curls or not +since we have upper bounds on how many curls can be recruited, this test is +redundant and can lead to problems. +- API-README update cgminer version number +- API-README fix groups P: example mistake +- API-README add COIN and other edits +- miner.php allow 'coin' is custom pages + + +BFGMiner Version 2.7.1 - August 22, 2012 + +- Update windows build instructions courtesy of sharky. +- Increase max curls to number of mining threads + queue * 2, accounting for up +and downstream comms. +- Queue enough requests to get started. +- There is no point trying to clone_work in get_work() any more since we clone +on every get_work_thread where possible. +- There is no point subtracting 1 from maxq in get_work_thread. +- miner.php allow page title to be defined in myminer.php +- Only set lagging flag once there are no staged work items. +- select_pool does not switch back to the primary once lagging is disabled. +- Increment total work counter under mutex lock. +- Increment the queued count after the curl is popped in case there's a delay +waiting on curls and we think we've queued work when in fact we're waiting on +curls. +- Do the dynamic timing in opencl code over a single pass through scanhash to +make sure we're only getting opencl times contributing to the measured +intervals. +- Increase curl reaping time to 5 minutes since comms between curl requests can +be 2 mins apart with lots of rolltime. +- No need for extra variable in hash_push. +- Remove short options -r and -R to allow them to be reused and remove readme +entries for deprecated options. +- Deprecate the opt_fail_pause parameter, leaving a null placeholder for +existing configurations. +- Free work before retrying in get_work_thread. +- Don't pause after failed getwork, set lagging flag and reassess. +- We should not be pausing in trying to resubmit shares. +- Get rid of the extending fail pause on failed connects since we discard work +after a period. +- get_work always returns true so turn it into a void function. +- get_work never returns false so get rid of fail pause loop. +- Get rid of pause and retry from get_upstream_work so we only do it from one +place. +- Remove all cases where --retries aborts BFGMiner, making it for submission +retries only, where it makes sense. + + +BFGMiner Version 2.7.0 - August 21, 2012 + +- Implement a new pool strategy, BALANCE, which monitors work performed per pool +as a rolling average every 10 minutes to try and distribute work evenly over all +the pools. Do this by monitoring diff1 solutions to allow different difficulty +target pools to be treated equally, along with solo mining. Update the +documentation to describe this strategy and more accurately describe the +load-balance one. +- fpga serial I/O extra debug (disabled by default) +- Getwork fail was not being detected. Remove a vast amount of unused variables +and functions used in the old queue request mechanism and redefine the getfail +testing. +- Consider us lagging only once our queue is almost full and no staged work. +- Simplify the enough work algorithm dramatically. +- Only queue from backup pools once we have nothing staged. +- Don't keep queueing work indefinitely if we're in opt failover mode. +- Make sure we don't opt out of queueing more work if all the queued work is +from one pool. +- Set lagging flag if we're on the last of our staged items. +- Reinstate clone on grabbing work. +- Grab clones from hashlist wherever possible first. +- Cull all the early queue requests since we request every time work is popped +now. +- Keep track of staged rollable work item counts to speed up clone_available. +- Make expiry on should_roll to 2/3 time instead of share duration since some +hardware will have very fast share times. +- Check that we'll get 1 shares' worth of work time by rolling before saying we +should roll the work. +- Simplify all those total_secs usages by initialising it to 1 second. +- Overlap queued decrementing with staged incrementing. +- Artificially set the pool lagging flag on pool switch in failover only mode as +well. +- Artificially set the pool lagging flag on work restart to avoid messages about +slow pools after every longpoll. +- Factor in opt_queue value into enough work queued or staged. +- Roll work whenever we can on getwork. +- Queue requests for getwork regardless and test whether we should send for a +getwork from the getwork thread itself. +- Get rid of age_work(). +- Don't try to get bitforce temperature if we're polling for a result to +minimise the chance of interleaved responses. +- Fix harmless unused warnings in scrypt.h. +- Check we are not lagging as well as there is enough work in getwork. + + +BFGMiner Version 2.6.5 - August 20, 2012 + +- API new command 'coin' with mining information +- Add message to share if it's a resubmit. +- Add virtual adl mapping for when none is specified on the command line to +not crash without a map specified. +- Fix ADL gpu-map not working when there are more ADL devices than openCL. +Patch supplied and tested by Nite69. +- bitforce: Initial import of Linux-only bitforce-firmware-flash utility +- Revert stale-on-arrival failsafe, since it ends up needing exceptions for +everything +- Bugfix: opencl: Declare opencl_dynamic_cleanup in header +- Even if we want to submit stale shares, give up if we have more submissions +waiting on threads (even before failing) +- Even if we want to submit stale shares, give up if they've failed and we +have more submissions waiting on threads +- opencl: Use timeBeginPeriod on Windows to ensure gettimeofday has sufficient +precision for dynamic intensity +- Bugfix: opencl: Move ADL fanspeed warning messages to a new thread to get +around summary-update deadlocking +- README: Note that user groups don't get updated until re-login +- Initialise cnt in libztex.c +- Don't try to start devices that don't support scrypt when scrypt mining. +- Repeating on timeout in ztex could make the code never return. +- Offset libusb reads/writes by length written as well in ztex. +- Cope with timeouts and partial reads in ztex code. +- If there are more devices than nDevs, don't iterate over them as they may +overwrite devices mapped below that with the mapping option. +- Fix README faq on bfl auto-detect. +- Set memory clock based on memdiff if present from with engine changes, +allowing it to parallel manual changes from the menu as well. +- api.c typo +- API allow display/change failover-only setting +- API-README corrections +- miner.php documentation (in API-README) v0.1 +- Bugfix: opencl: Show blank device-info statline area if GPU doesn't have +ADL, to fix column alignment +- README: Document usage of 0 to indicate "leave at default" for comma- +delimited GPU options +- Correct API-README versions to match when BFGMiner included them +- API-README update changelog +- Minimise locking and unlocking when getting counts by reusing shared mutex +lock functions. +- Avoid getting more work if by the time the getwork thread is spawned we find +ourselves with enough work. +- The bitforce buffer is cleared and hw error count incremented on return from a +failed send_work already so no need to do it within the send_work function. +- Don't make mandatory work and its clones last forever. +- modminer: Log debug info for nonces found + + +BFGMiner Version 2.6.4 - August 11, 2012 + +- Bugfix: Define my_cancellable_getch in miner.h +- Escape " and \ when writing json config file +- miner.php allow a custom page section to select all fields with '*' - e.g. to +create a STATS section on a custom page +- miner.php optional single rig totals (on by default) +- Bugfix: Initialize submitting mutex +- Bugfix: bitforce: Allocate enough space for FTDI description pointers +- Queue one request for each staged request removed, keeping the staged +request count optimal at all times. +- Bugfix: Avoid cancelling threads while locks are held +- Set recognizable names on threads for debugging +- Bugfix: Don't keep making new get_work threads if all pools are dead +- Enable configuring submission thread limit with --submit-threads option +- Bugfix: Limit active submission threads to 0x40 so we don't overflow +- Bugfix: Properly handle switching to pools that aren't on the latest block, +and warn if a pool actively switches to an old block +- Log more details of reasons in stale_work debug messages +- Failsafe against stale-on-arrival work: disable the pool +- Bugfix: Debug message should show "Work stale due to work restart" when it's +not a share +- windows-build: Remove APP SDK section since it is no longer needed +- modminer: HACK: Let last_work handle the end of the work, and start the next +one immediately +- Bugfix: modminer: Remove erroneous "else" statement, to fix hashrate +reporting +- README: Document user group required for FPGAs on Gentoo and Ubuntu +- BFGMiner-specific README adjustments +- Bugfix: opencl: Ignore error getting device ids from platforms unless they +are explicitly chosen +- New --debuglog option to include debug info in stderr logfile even if not in +the console +- Bumped down debhelper compatibility reqs so that this will build on Lucid. +- Updated to match packaging changes. +- Switched to native packages so we don't have to muck around creating fake +upstream tarballs, and can easily generate minor versions for upload to +Launchpad. +- Removed accidentally included debugging line. +- Minor version bump again because of launchpad. Will sort this out for next +release. +- Updated to patch bitforce module issue on Debian/Ubuntu. +- Added local quilt config dir to ignore. +- modminer: Check nonce against previous work, in case of race +- Bugfix: Enable --kernel-path option if ModMiner or Ztex is enabled (even if +no OpenCL) +- Bugfix: Escape backslashes and double-quotes in strings that rightfully may +have them, when writing JSON config file +- Clean object (.o) and dependency (.d) files out of source tree +- Bugfix: bitforce: Don't count hashes that never happened due to throttling +- Bugfix: Deal with serial_open timeout maximum (25.5s) +- - fpgautils: Linux only supports uint8_t decisecond values for timeouts, so +use uint8_t for timeout value; this gets smart compilers to throw warnings +when overflowed in some cases +- - bitforce: Reduce serial timeout to 25 seconds (was 30) and increase job +long timeout to 25 seconds (was 15) to handle throttling gracefully +- modminer: Add debug info to API extra device stats +- modminer: Raise clock speed when there's only good nonces for a while +- modminer: Only print clock speed adjustments when they actually change +- modminer: Increase tolerance for bad nonces to 2% +- modminer: Reset bad-nonce ratio measurement when the clock speed changes +- Bugfix: bitforce: Include the correct device id in "garbled response" warning +- ADL: Add attribution and disclaimer to interfaces +- Cleaned out refs to AMD SDKs. +- Updated README about debian packaging, changelog with minor version bump to +work around Launchpad reqs. +- Updated changelog with Ubuntu release specific version, needed to build for +multiple releases. Also stripped out ADL SDK stuff in the build rules. +- Initial work to adjust debian packaging from cgminer. Should build correctly +now with pbuilder/pdebuild, and include docs. +- Adapt miner code to free ADL structures +- Import free ADL interfaces +- Include scrypt.h in Makefile. +- Fix windows bitforce build. +- Convert the serial autodetect functions to use int instead of char to +enumerate devices. +- Uglify windows autodetect code for BFL. +- There is no point zeroing temperature in BFL if we fail to get a response, and +we should register it as a HW error, suggesting throttling. +- Update SCRYPT README with information about HW errors. +- Use the scrypt CPU code to confirm results from OCL code, and mark failures as +HW errors, making it easier to tune scrypt parameters. +- We may as well leave one curl still available per pool instead of reaping the +last one. +- Display reaped debug message outside mutex lock to avoid recursive locking. +- api.c update API start message and include port number +- miner.php ignore arg when readonly +- miner.php allow pool inputs: delete, addpool, poolpriority +- bitforce: Reopen on communication error +- Bugfix: Calculate hw err percent for the affected FPGA only +- make-release: Adapt to new autogen by using NOCONFIGURE var + + +BFGMiner Version 2.6.3 - August 6, 2012 + +- modminer: Relax no-nonces downclocking condition to be more reasonable +- README: Update scrypt configure option +- README: Update configure options +- Bugfix: Display --disable-modminer in configure --help now that it is +enabled by default +- Add specific information when ADL detects error -10 saying the device is not +enabled. +- modminer: Shorten upload warning message to fit better +- modminer: Sending a "ping" first, to workaround bug in new firmware betas +- modminer: Include Hardware Errors and Valid Nonces in extra device status +- Bugfix: modminer: Calculate bad-nonce percentage based only on the same +FPGA's hardware errors, accurately +- modminer: Show bitstream upload progress in statline, and only report to log +every 10% +- modminer: Be more verbose about why the clock is getting reduced +- Document how Icarus golden nonce is handled by other FPGAs +- Rewrite should_run for sched, to properly handle one-shot schedules spanning +midnight +- Bugfix: Check list_empty in pop_curl_entry after condition wait +- Bugfix: Only add new pools to array after completing basic structure +initialization +- If __BFGMINER_SEGFAULT_ERRQUIT is set in the environment, segfault on +non-zero quit()s +- Check against NULL pointers getting into curlring +- modminer: Finish a process results run with a nonce poll, rather than sleep +- modminer: Workaround Windows driver failures +- Count likely throttling episodes on bitforce devices as hardware errors. +- Bugfix: bitforce: Increase serial read timeout to 30 seconds during actual +mining, to tolerate more throttling +- Style cleanups. +- Make pool_disabled the first in the enums == 0, fixing the pool enabled count +which compares if value is not enabled before enabling it. +- Correct writing of scrypt parameters to config file based on command line +parameters only. +- Add scrypt support while writing conf +- Use different variables for command line specified lookup gap and thread +concurrency to differentiate user defined versus auto chosen values. +- Queue a request on pool switch in case we have no work from the new pool yet. +- API remove unused warning in non-GPU compile +- api.c in linux allow to open a closed socket in TIME_WAIT +- Display failover only mode in pool menu and allow it to be toggled live. +- Reinstate check for system queueing lag when the current pool's queue is maxed +out, there is no staged work, and the work is needed now. +- Fix harmless warnings. +- Check the current staged and global queued as well before queueing requests. +Discard stales before ageing work in the watchdog thread. Queue requests after +discarding and ageing work in watchdog thread. Display accurate global queued in +curses output. Reuse variable in age_work(). +- The queueing mechanism has become a complex state machine that is no longer +predictable. Rewrite it from scratch watching only current queues in flight and +staged work available on a pool by pool basis. +- Update debian package configs to v2.6.2 +- Queue an extra request whenever staged work drops below mining thread count in +hash_pop. +- Bugfix: Initialize logwin to 1 line high temporarily, to avert PDCurses crash +- Enable FPGA support by default, as long as their dependencies are met +- Bugfix: modminer: Search for *ModMiner* in udev ID_MODEL +- make-release: build with --enable-scrypt +- miner.php support custom report section joins +- ICA default fpga_count to work_division if specified +- FPGA-README document new hidden --icarus-options +- ICA support 57600 baud rate, up to 8 FPGA and partial working FPGA boards +- Scrypt mining does not support block testing yet so don't try to print it. +- Clear the bitforce buffer whenever we get an unexpected result as it has +likely throttled and we are getting cached responses out of order, and use the +temperature monitoring as a kind of watchdog to flush unexpected results. +- It is not critical getting the temperature response in bitforce so don't +mandatorily wait on the mutex lock. +- Check there is a cutoff temp actually set in bitforce before using it as a cut +off value otherwise it may think it's set to zero degrees. +- We dropped the temporary stopping of curl recruiting on submit_fail by +mistake, reinstate it. +- Make threads report in either side of the scanhash function in case we miss +reporting in when restarting work. +- Add debugging output when work is found stale as to why. +- Print the 3 parameters that are passed to applog for a debug line in +bitforce.c +- Clear bitforce buffer on init as previously. +- Add some headroom to the number of curls available per pool to allow for +longpoll and sendwork curls. +- Show the correct base units on GPU summary. +- Bugfix: bitforce: 1 decisecond timeout is unreasonably short, give it a +second +- Bugfix: Don't try to log abandon time, since we aren't keeping track +reasonably +- Import uthash 1.9.6 +- Bugfix: bitforce: Pause after send_work failures +- Fix comm error handling to not consider work restarts an error condition +- comm error bug fix +- Bugfix: No endian.h on Windows +- Remove unused mkinstalldirs +- Display scrypt as being built in as well. +- Fix build warning about KL_SCRYPT when built without scrypt support. +- News update. +- More scrypt intensity information. +- Minor readme updates. +- Update README with more build instructions. +- Remove the low hash count determinant of hardware being sick. A low hash rate +can be for poor network connectivity or scrypt mining, neither of which are due +to sick hardware. +- Style +- API-README poolpriority changes +- api.c verify poolpriority parameters before changing pools +- api.c poolpriority changes +- Implement shared swap32(yes|tole|tobe) function to handle endian flipping +32-bit chunks in blocks +- Use correct macros for endian handling code + + +BFGMiner Version 2.6.1 - July 29, 2012 + +- Autoselect --scrypt iff all pools send scrypt work +- Adapt SCRYPT-README to BFGMiner (directing Bitcoin donations the correct +direction to reach Con) +- Remove mentions of Litecoin specifically +- Bugfix: Fix build without OpenCL but with scrypt +- make-release: Add SCRYPT-README +- Bump version 2.6.0, adding SCRYPT README to makefile. +- Smarter autogen.sh script. +- Sleeping on intensity decrease is broken, remove it. +- Sleep only the extra amount of time we overran the dynamic interval in dynamic +mode. +- Add scrypt documentation in the form of a separate readme. +- Fix build error without scrypt enabled. +- Limit thread concurrency for scrypt to 5xshaders if shaders is specified. +- Simplify repeated use of gpus[gpu]. in ocl.c +- Find the nearest power of 2 maximum alloc size for the scrypt buffer that can +successfully be allocated and is large enough to accomodate the thread +concurrency chosen, thus mapping it to an intensity. +- Don't make opt_scrypt mandatory blocking with opencl code. +- Update kernel versions reflecting changes in the API. +- Make the thread concurrency and lookup gap options hidden on the command line +and autotune parameters with a newly parsed --shaders option. +- Fix target testing with scrypt kernel as it would have been missing shares +below target. +- Always create the largest possible padbuffer for scrypt kernels even if not +needed for thread_concurrency, giving us some headroom for intensity levels. +- Use the detected maximum allocable memory on a GPU to determine the optimal +scrypt settings when lookup_gap and thread_concurrency parameters are not given. +- Check the maximum allocable memory size per opencl device. +- Add debugging output if buffer allocation fails for scrypt and round up +bufsize to a multiple of 256. +- Nonce testing for btc got screwed up, leading to no accepted shares. Fix it. +- Display size of scrypt buffer used in debug. +- Allow intensities up to 20 if scrypt is compiled in. +- Add name to scrypt kernel copyright. +- Allow lookup gap and thread concurrency to be passed per device and store +details in kernel binary filename. +- Ignore negative intensities for scrypt. +- Change the scale of intensity for scrypt kernel and fix a build warning. +- Correct target value passed to scrypt kernel. +- Use 256 output slots for kernels to allow 1 for each worksize. +- Test the target in the actual scrypt kernel itself saving further +calculations. +- Reinstate GPU only opencl device detection. +- Decrease lookup gap to 1. Does not seem to help in any way being 2. +- Fix build. +- Make pad0 and pad1 local variable in scrypt kernel. +- Constify input variable in scrypt kernel. +- Send correct values to scrypt kernel to get it finally working. +- Create command queue before compiling program in opencl. +- Fix external scrypt algo missing. +- Limit scrypt to 1 vector. +- Handle KL_SCRYPT in config write. +- Get rid of stuff. +- Don't enqueuewrite buffer at all for pad8 and pass work details around for +scrypt in dev_blk. +- Set the correct data for cldata and prepare for pad8 fixes. +- Get rid of spaces in arrays in scrypt kernel. +- Start with smaller amount of hashes in cpu mining to enable scrypt to return +today sometime. +- Free the scratchbuf memory allocated in scrypt and don't check if CPUs are +sick since they can't be. Prepare for khash hash rates in display. +- Add cpumining capability for scrypt. +- Set scrypt settings and buffer size in ocl.c code to be future modifiable. +- Cope with when we cannot set intensity low enough to meet dynamic interval by +inducing a forced sleep. +- Make dynamic and scrypt opencl calls blocking. +- Fix nonce submission code for scrypt. +- Make sure goffset is set for scrypt and drop padbuffer8 to something +manageable for now. +- Set up buffer8 for scrypt. +- Build fix for opt scrypt. +- Don't check postcalc nonce with sha256 in scrypt. +- Don't test nonce with sha and various fixes for scrypt. +- Make scrypt buffers and midstate compatible. +- Use specific output array entries in scrypt kernel. +- Provide initial support for the scrypt kernel to compile with and mine scrypt +with the --scrypt option. +- Enable completely compiling scrypt out. +- Begin import of scrypt opencl kernel from reaper. + + +BFGMiner Version 2.5.3 - July 29, 2012 + +- Bugfix: Add zlib1.dll to Win32 release archive +- Bugfix: SICK low-hashrate is now determined by being under 1/3 the runtime +average hashrate +- Bugfix: cpu_set_t is never #defined, so use CPU_ZERO which is a macro + + +BFGMiner Version 2.5.2 - July 29, 2012 + +- Limit total number of curls recruited per pool to the number of mining threads +to prevent blasting the network when we only have one pool to talk to. +- Bugfix: Skip writing configuration of range-limited int options with negative +values +- Bugfix: Correctly attempt to load ~/.bfgminer/bfgminer.conf or +~/.cgminer/cgminer.conf as defaults +- Send X-Minimum-Wait header on longpolls, to explicitly inform pools we will +handle a response with no delay +- bitforce: Abandon (only) stale searches for work restarts +- Keep a counter of enabled pools and use that instead of iterating over the +pool list. Use that value to ensure we don't set the last remaining active pool +to the rejecting state. +- bitforce: Skip out of sending work if work restart requested +- RPC: Writeup on poolpriority command usage +- Bugfix: API: Report errors from poolpriority command +- RPC: New "poolpriority" command to set the order of pool priorities +- strtok_ts: Thread-safe strtok that work on POSIX or Windows +- Bugfix: Supress "caught up" event when first switching to a pool +- Announce and restart work immediately when current pool has caught up to the +current block +- Bugfix: Don't consider work stale due to other pools' longpolls, if +--failover-only is active +- Refactor stale_work function to only flag actual stale shares +- stale_work: Don't factor getwork delay into expiry for shares (only for work +itself) +- Bugfix: Use pool number rather than numeric pointer to strict pool, in block +found notice +- Accept JSON Numbers in config file parameters +- Improve readability of OPT_HASARG in parse_config +- Allow JSON false as a valid value for strictly boolean options +- Include scan-serial in example configuration file +- fpgautils: add support for 57.6 kBd serial +- miner.php add a socket RCV timeout for if cgminer is hung and the API thread +is still running +- BFL force all code to timeout to avoid hanging +- Initialise mdplatform. +- Find the gpu platform with the most devices and use that if no platform option +is passed. +- Bugfix: It is not a hardware error if nonces returned from modminer don't +meet the pool target +- bitforce & icarus: Log detection failures at debug log level, so we don't +confuse users who have different devices (which is why these drivers are +failing detection!) +- Show "WAIT" (LIFE_WAIT status) if a cgpu is idle waiting for work (pool +slow/dead) +- Instead of quitting on failing N retries, just discard the share +- Bugfix: Don't discard stale shares after submission failure, if user or pool +wants stales submitted +- Bugfix: Record discard-during-retry shares in the sharelog +- Bugfix: Only show Algorithm in RPC summary if CPU mining is actually active +- OpenCL: Remove intensity from statline, since it overflowed +- Move "Q" (requested getworks) to second status line as "GW" to balance out +better +- Bugfix: Use a mutex to control non-curses output +- Simplify code to a single vprintf path for curses-less printing +- Move opt_quiet check to my_log_curses, so it works for curses-less builds +- Use log_generic for vapplog to cut down on code duplication +- Bugfix: Copy argv[0] given to dirname() +- Find the gpu platform with the most devices and use that if no platform +option is passed. +- Allow more platforms to be probed if first does not return GPUs. +- Detach pthread from within the api thread in case it is terminated due to not +being instantiated before pthread_cancel is called from main, leading to a +segfault. +- Debug output per thread hashrate is out by a factor of 1000. +- Don't check if CPUs are sick since they can't be. +- Calculate midstate in separate function and remove likely/unlikely macros +since they're dependent on pools, not code design. +- Display in debug mode when we're making the midstate locally. +- Bugfix: Document --no-adl and --gpu-platform +- Bugfix: Remove redundant documentation of --auto-fan and --auto-gpu (they +are in GPU-specific options) +- CPU mining may not be included in binaries, but it's not deprecated for +BFGMiner either +- Bugfix: Restore case-insensitivity to input +- Scroll the device list with up/down arrow keys, if it is overflowed +- Use select statement to handle input +- Bugfix: Actually check that the device fits in the individual summary window +before trying to print it +- Bugfix: Fix build without curses but with OpenCL +- Bugfix: Don't show a Temperature key if it isn't known +- BFGMiner-specific NEWS fix + + +BFGMiner Version 2.5.1 - July 13, 2012 + +- Replace CPU Algo in header with runtime +- Bugfix: Calculate diff-1 utility to fix utility-hashrate on pools with +diff!=1 +- Add utility hashrate to curses display +- Show units in kh, Gh, Th, etc as needed to use at most 3 integer digits +- Use FTD2XX.DLL on Windows to autodetect BitFORCE SHA256 devices +- bitforce_get_result returns -1 on error now. +- Check return value of read in BFgets +- Bugfix: modminer: Count hashes done before work restart +- Bugfix: modminer: Adapt "get nonce" error condition to new scanhash=>-1 +error API +- Bugfix: Make our Windows nanosleep/sleep replacements standards-compliant +(which fixes nmsleep) and include compat.h for bitforce (for sleep) +- miner.php fix rig # when miners fail +- Fix whitespace mangling. +- bitforce: Use "full work" vs "nonce range" for kernel name +- Abbrv. correction +- Remove superfluous ave_wait +- Put kname change for broken nonce-range back in +- Add average wait time to api stats +- Revert "Merge branch 'ave_time' of https://github.com/pshep/cgminer.git" +- Add average return time to api stats +- Missed one nonce-range disabling. +- Change timeouts to time-vals for accuracy. +- More BFL tweaks. Add delay between closing and reopening port. Remove buffer +clear in re-init Add kernel type (mini-rig or single) +- Revert "Change BFL driver thread initialising to a constant 100ms delay +between devices instead of a random arrangement." +- Only try to shut down work cleanly if we've successfully connected and started +mining. +- Fix spelling. +- modminer: Firmware returns 0xffffff00 immediately if we set clockspeed too +high +- Bugfix: modminer: Actually count good shares +- Bugfix: Adapt OpenCL scanhash errors to driver API change (errors are now -1, +not 0) +- Remove bitforce_thread_init The delay thing does nothing useful... when long +poll comes around, all threads restart at the same time anyway. +- fix API support for big endian machines +- Bugfix: Use const struct device_api* for mt_disable +- modminer: Show progress of bitstream upload +- Bugfix: Don't declare devices SICK if they're just busy initializing +- Bugfix: Calculate nsec in nmsleep correctly +- miner.php allow rig names in number buttons +- Change BFL driver thread initialising to a constant 100ms delay between +devices instead of a random arrangement. +- Spelling typo. +- Time opencl work from start of queueing a kernel till it's flushed when +calculating dynamic intensity. +- Modify te scanhash API to use an int64_t and return -1 on error, allowing zero +to be a valid return value. +- Check for work restart after the hashmeter is invoked for we lose the hashes +otherwise contributed in the count. +- Remove disabled: label from mining thread function, using a separate +mt_disable function. +- Style changes. +- Cope with signals interrupting the nanosleep of nmsleep. +- Use standard cfsetispeed/cfsetospeed to set baud rate on *nix +- miner.php split() flagged deprecated in PHP 5.3.0 +- Bugfix: Use nmsleep instead of restart_wait, so we always wait the full time +- Make long timeout 10seconds on bitforce for when usleep or nanosleep just +can't be accurate... + + +BFGMiner Version 2.5.0 - July 7, 2012 + +- Fix BitFORCE driver to not silenty discard valid shares (bug introduced by +CGMiner merges) +- Fix --benchmark not working since the dynamic addition of pools and pool +stats. +- Make disabling BFL nonce range support a warning since it has to be explicitly +enabled on the command line now. +- miner.php allow renaming table headers +- Make bitforce nonce range support a command line option --bfl-range since +enabling it decrease hashrate by 1%. +- Add sanity checking to make sure we don't make sleep_ms less than 0 in +bitforce. +- The fastest minirig devices need a significantly smaller starting sleep time. +- Use a much shorter initial sleep time to account for faster devices and nonce +range working, and increase it if nonce range fails to work. +- Use nmsleep instead of usleep in bitforce. +- Provide a ms based sleep function that uses nanosleep to avoid the inaccuracy +of usleep on SMP systems. +- delay_time_ms is always set so need not be initialised in bitforce. +- Increase bitforce timeout to 10 seconds. +- Add more hysteresis and poll ~5 times to allow for timer delays in bitforce +devices. +- miner.php allow alternating line colours (off by default) +- Display the actual duration of wait when it is greater than the cutoff. +- Set nonce to maximum once we determine nonce range support is broken. +- Initial wait time is always known so no need to zero it beforehand in +bitforce. +- No point counting wait time until the work is actually sent to bitforce +devices. +- Use string comparison functions instead of explicit comparisons. +- Account for wait_ms time when nonce_range is in use on BFL. +- Split nonces up into 1/5 chunks when nonce range is supported. +- limit clear buffer iterations. +- Ad fd check to clear buffer. +- miner.php remove incorrect 'DATE' error message +- miner.php allow summary header in custom pages +- Disable nonce range support in BFL when broken support is detected. +- Restart_wait is only called with a ms value so incorporate that into the +function. +- Only try to adjust dev width when curses is built in. +- miner.php define custom sum fields as a simple array +- Fix off-by-one error in nonce increment in bfl. +- Use BE when setting nonce in bitforce nonce range work. +- Enable nonce range in the normal init sequence for bfl. +- Queue extra work at 2/3 differently depending on whether we're using nonce +range or not. +- Initially enable support for nonce range support on bfl, splitting nonces up +into 3/4 size and only disable it if it fails on work submit. +- Attempt to detect nonce range support in BFL by sending work requring its +support. +- Limit retrying on busy for up to BITFORCE_TIMEOUT_MS +- Attempt to initialise while bitforce device returns BUSY. +- Extend length of string that can be passed to BFL devices. +- Fix signedness warning. +- Adjust device width column to be consistent. +- Use cgpu-> not gpus[] in watchdog thread. +- Add api stats (sleep time) +- Timing tweaks Added long and short timeouts, short for detecting throttling, +long to give up totally. Reset sleep time when device re-initialised Still check +results after timeout Back up a larger time if result on first poll. +- Add API Notify counter 'Comms Error' +- Style police on api.c +- Do all logging outside of the bitforce mutex locking to avoid deadlocks. +- Remove applog call from bfwrite to prevent grabbing nested mutexes. +- Bitforce style changes. +- Minor style changes. +- Remove needless roundl define. +- Made JSON error message verbose. +- Fine-tune timing adjustment. Also remove old work_restart timing. +- Check for gpu return times of >= 0, not just 0, to fix intensity dropping to +-10. +- Restart is zeroed in the mining thread so no need to do it inside the bitforce +code. +- More improvements to comms. BFL return nothing when throttling, so should not +be considered an error. Instead repeat with a longer delay. +- Polling every 10ms there's not much point checking the pthread_cond_timedwait +as it just adds overhead. Simply check the value of work_restart in the bfl main +polling loop. +- Use a pthread conditional that is broadcast whenever work restarts are +required. Create a generic wait function waiting a specified time on that +conditional that returns if the condition is met or a specified time passed to +it has elapsed. Use this to do smarter polling in bitforce to abort work, queue +more work, and check for results to minimise time spent working needlessly. +- Add busy time to wait time. +- api.c put version up to 1.14 +- Add tiny delay after writing to BFL Change BFL errors to something more human +readable Send work busy re-tries after 10ms delay +- Fix race condition in thread creation that could under some conditions crash +BFGMiner at startup + + +BFGMiner Version 2.4.4 - July 1, 2012 + +- Fix builds on non gnu platforms. +- api.c ensure old mode is always available when not using --api-groups + quit() +on param errors +- Implement rudimentary X-Mining-Hashrate support. +- Detect large swings in temperature when below the target temperature range and +change fan by amounts dependant on the value of tdiff. +- Adjust the fanspeed by the magnitude of the temperature difference when in the +optimal range. +- Revert "Restarting cgminer from within after ADL has been corrupted only leads +to a crash. Display a warning only and disable fanspeed monitoring." +- api.c fix json already closed +- implement and document API option --api-groups +- Put upper bounds to under 2 hours that work can be rolled into the future for +bitcoind will deem it invalid beyond that. +- define API option --api-groups +- api.c allow unwell devices to be enabled so they can be cured +- miner.php - fix/enable autorefresh for custom pages +- miner.php allow custom summary pages - new 'Mobile' summary +- Work around pools that advertise very low expire= time inappropriately as this +leads to many false positives for stale shares detected. +- Only show ztex board count if any exist. +- There is no need for work to be a union in struct workio_cmd +- fpgautils.c include a debug message for all unknown open errors +- Don't keep rolling work right up to the expire= cut off. Use 2/3 of the time +between the scantime and the expiry as cutoff for reusing work. +- Log a specific error when serial opens fail due to lack of user permissions +- Increase GPU timing resolution to microsecond and add sanity check to ensure +times are positive. +- Opencl code may start executing before the clfinish order is given to it so +get the start timing used for dynamic intensity from before the kernel is +queued. +- fpgautils.c - set BAUD rate according to termio spec +- fpgautils.c - linux ordering back to the correct way +- miner.php remove unneeded '.'s +- miner.php add auto refresh options +- miner.php add 'restart' next to 'quit' +- miner.php make fontname/size configurable with myminer.php +- Make the pools array a dynamically allocated array to allow unlimited pools to +be added. +- Make the devices array a dynamically allocated array of pointers to allow +unlimited devices. +- Dynamic intensity for GPUs should be calculated on a per device basis. Clean +up the code to only calculate it if required as well. +- Bugfix: Provide alternative to JSON_ENCODE_ANY for Jansson 1.x +- Use a queueing bool set under control_lock to prevent multiple calls to +queue_request racing. +- Use the work clone flag to determine if we should subtract it from the total +queued variable and provide a subtract queued function to prevent looping over +locked code. +- Don't decrement staged extras count from longpoll work. +- Count longpoll's contribution to the queue. +- Increase queued count before pushing message. +- Test we have enough work queued for pools with and without rolltime +capability. +- As work is sorted by age, we can discard the oldest work at regular intervals +to keep only 1 of the newest work items per mining thread. +- Roll work again after duplicating it to prevent duplicates on return to the +clone function. +- Abstract out work cloning and clone $mining_threads copies whenever a rollable +work item is found and return a clone instead. +- api.c display Pool Av in json +- Take into account average getwork delay as a marker of pool communications +when considering work stale. +- Work out a rolling average getwork delay stored in pool_stats. +- Getwork delay in stats should include retries for each getwork call. +- Walk through the thread list instead of searching for them when disabling +threads for dynamic mode. +- Extend nrolltime to support the expiry= parameter. Do this by turning the +rolltime bool into an integer set to the expiry time. If the pool supports +rolltime but not expiry= then set the expiry time to the standard scantime. +- When disabling fanspeed monitoring on adl failure, remove any twin GPU +association. This could have been leading to hangs on machines with dual GPU +cards when ADL failed. +- modminer: Don't delay 2nd+ FPGAs during work restart +- Disable OpenCL code when not available. +- Fix openwrt crashing on regeneratehash() by making check_solve a noop. +- Fix sign warning. +- Bugfix: icarus: properly store/restore info and work end times across longpoll +restarts +- Enable modminer for release builds + + +BFGMiner Version 2.4.3 - June 14, 2012 + +- Change device API "name" to reflect driver name abbreviation instead of device type name +- miner.php allow a separate user settings file +- modminer: Implement extended device stats to expose each Board to the RPC API +- Bugfix: Use new cgpu->thr for longpoll waking +- bitforce: Remove 4.5s delay before polling starts, since MiniRig finishes sooner +- FPGA - allow device detect override without an open failure +- Bugfix: Missing printf value in merge from cgminer +- Ensure C compiler is in C99 mode +- Add CPU core count detection for BSD/Mac +- Set CPU mining idle priority on Windows +- can_roll and should_roll should have no bearing on the cycle period within the +miner_thread so remove it. +- Check for strategy being changed to load balance when enabling LPs. +- Check that all threads on the device that called get_work are waiting on +getwork before considering the pool lagging. +- Iterate over each thread belonging to each device in the hashmeter instead of +searching for them now that they're a list. +- When using rotate pool strategy, ensure we only select from alive enabled +pools. +- Start longpoll from every pool when load balance strategy is in use. +- Add mandatory and block fields to the work struct. Flag any shares that are +detected as blocks as mandatory to submit, along with longpoll work from a +previously rejecting pool. +- Consider the fan optimal if fanspeed is dropping but within the optimal speed +window. +- Fix typo in some API messages (succeess/success) +- api.c MMQ stat bugs +- Bugfix: Fix warnings when built without libudev support +- Bugfix: slay a variety of warnings +- Bugfix: modminer: Fix unsigned/signed comparison and similar warnings +- API add ModMinerQuad support +- Bugfix: Honour forceauto parameter in serial_detect functions +- modminer: Temperature sensor improvements +- modminer: Make log messages more consistent in format +- Only adjust GPU speed up if the fanspeed is within the normal fanrange and +hasn't been turned to maximum speed under overheat conditions. +- ModMiner use valid .name +- New driver: BTCFPGA ModMiner +- Abstract generally useful FPGA code into fpgautils.c +- API add stats for pool getworks +- miner.php option to hide specific fields from the display +- miner.php add version numbers to the summary page +- Update debian configs to v2.4.2 +- Add API and FPGA READMEs into Makefile to be included in source distribution. +- Icarus - fix unit64_t printf warnings + + +BFGMiner Version 2.4.2 - June 2, 2012 + +- Use epoll to immediately interrupt Icarus with new work on longpolls (Linux) +- API.class compiled with Java SE 6.0_03 - works with Win7x64 +- miner.php highlight devs too slow finding shares (possibly failing) +- API update version to V1.11 and document changes +- API save default config file if none specified +- api.c save success incorrectly returns error +- api.c replace BUFSIZ (linux/windows have different values) +- Move RPC API content out of README to API-README +- Open a longpoll connection if a pool is in the REJECTING state as it's the +only way to re-enable it automatically. +- Use only one longpoll as much as possible by using a pthread conditional +broadcast that each longpoll thread waits on and checks if it's the current pool +before +- If shares are known stale, don't use them to decide to disable a pool for +sequential rejects. +- Restarting cgminer from within after ADL has been corrupted only leads to a +crash. Display a warning only and disable fanspeed monitoring. +- Icarus: fix abort calculation/allow user specified abort +- Icarus: make --icarus-timing hidden and document it in FPGA-README +- Icarus: high accuracy timing and other bitstream speed support +- add-MIPSEB-to-icarus-for-BIG_ENDIAN +- work_decode only needs swab32 on midstate under BIG ENDIAN +- add compile command to api-example.c +- save config bugfix: writing an extra ',' when no gpus +- Add dpkg-source commits + + +BFGMiner Version 2.4.1 - May 6, 2012 + +- Icarus: Calibrate hashrate yet even more accurately +- In the unlikely event of finding a block, display the block solved count with +the pool it came from for auditing. +- Display the device summary on exit even if a device has been disabled. +- Use correct pool enabled enums in api.c. +- Import Debian packaging configs +- Ensure we test for a pool recovering from idle so long as it's not set to +disabled. +- Fix pool number display. +- Give BFGMiner -T message only if curses is in use. +- Reinit_adl is no longer used. +- API 'stats' allow devices to add their own stats also for testing/debug +- API add getwork stats to BFGMiner - accesable from API 'stats' +- Don't initialise variables to zero when in global scope since they're already +initialised. +- Get rid of unitialised variable warning when it's false. +- Move a pool to POOL_REJECTING to be disabled only after 3 minutes of +continuous rejected shares. +- Some tweaks to reporting and logging. +- API support new pool status +- Add a temporarily disabled state for enabled pools called POOL_REJECTING and +use the work from each longpoll to help determine when a rejecting pool has +started working again. Switch pools based on the multipool strategy once a pool +is re-enabled. +- Removing extra debug +- Fix the benchmark feature by bypassing the new networking code. +- Reset sequential reject counter after a pool is disabled for when it is +re-enabled. +- ztex updateFreq was always reporting on fpga 0 +- Trying harder to get 1.15y working +- Specifying threads on multi fpga boards extra cgpu +- Missing the add cgpu per extra fpga on 1.15y boards +- API add last share time to each pool +- Don't try to reap curls if benchmarking is enabled. + + +BFGMiner Version 2.4.0 - May 3, 2012 + +- Only show longpoll warning once when it has failed. +- Convert hashes to an unsigned long long as well. +- Detect pools that have issues represented by endless rejected shares and +disable them, with a parameter to optionally disable this feature. +- Bugfix: Use a 64-bit type for hashes_done (miner_thread) since it can overflow +32-bit on some FPGAs +- Implement an older header fix for a label existing before the pthread_cleanup +macro. +- Limit the number of curls we recruit on communication failures and with +delaynet enabled to 5 by maintaining a per-pool curl count, and using a pthread +conditional that wakes up when one is returned to the ring buffer. +- Generalise add_pool() functions since they're repeated in add_pool_details. +- Bugfix: Return failure, rather than quit, if BFwrite fails +- Disable failing devices such that the user can attempt to re-enable them +- Bugfix: thread_shutdown shouldn't try to free the device, since it's needed +afterward +- API bool's and 1TBS fixes +- Icarus - minimise code delays and name timer variables +- api.c V1.9 add 'restart' + redesign 'quit' so thread exits cleanly +- api.c bug - remove extra ']'s in notify command +- Increase pool watch interval to 30 seconds. +- Reap curls that are unused for over a minute. This allows connections to be +closed, thereby allowing the number of curl handles to always be the minimum +necessary to not delay networking. +- Use the ringbuffer of curls from the same pool for submit as well as getwork +threads. Since the curl handles were already connected to the same pool and are +immediately available, share submission will not be delayed by getworks. +- Implement a scaleable networking framework designed to cope with any sized +network requirements, yet minimise the number of connections being reopened. Do +this by create a ring buffer linked list of curl handles to be used by getwork, +recruiting extra handles when none is immediately available. +- There is no need for the submit and getwork curls to be tied to the pool +struct. +- Do not recruit extra connection threads if there have been connection errors +to the pool in question. +- We should not retry submitting shares indefinitely or we may end up with a +huge backlog during network outages, so discard stale shares if we failed to +submit them and they've become stale in the interim. + + +BFGMiner Version 2.3.6 - April 29, 2012 + +- Shorten stale share messages slightly. +- Protect the freeing of current_hash under mutex_lock to prevent racing on it +when set_curblock is hit concurrently. +- Change default behaviour to submitting stale, removing the --submit-stale +option and adding a --no-submit-stale option. +- Make sure to start the getwork and submit threads when a pool is added on the +fly. This fixes a crash when a pool is added to running BFGMiner and then +switched to. +- Faster hardware can easily outstrip the speed we can get work and submit +shares when using only one connection per pool. +- Test the queued list to see if any get/submits are already queued and if they +are, start recruiting extra connections by generating new threads. +- This allows us to reuse network connections at low loads but recuit new open +connections as they're needed, so that BFGMiner can scale to hardware of any +size. + + +BFGMiner Version 2.3.5 - April 28, 2012 + +- Restarting BFGMiner leads to a socket that can't be bound for 60 seconds, so +increase the interval that API binding waits to 30 seconds to minimise the +number of times it will retry, spamming the logs. +- Give a longpoll message for any longpoll that detects a block change, primary +or backup, and also display which pool it was. +- Decrease utility display to one decimal place. +- Small cosmetic output alignment. +- Add pool number to stale share message. +- Add space to log output now that there is more screen real estate available. +- Indentation clean up. +- Remove thread id display from rejected shares as well. +- Merge pull request #185 from Diapolo/diakgcn +- add goffset support for diakgcn with -v 1 and update kernel version +- Set have_longpoll to true when there is at least one pool with longpoll. +- Don't display the thread ID since it adds no useful information over the +device number. +- Don't display the first 8 bytes of a share since they will always be zero at +>= 1 difficulty. +- work->longpoll is reset across test_work_current so we need to recheck what +pool it belongs to. +- Use longpolls from backup pools with failover-only enabled just to check for +block changes, but don't use them as work. +- Start longpoll only after we have tried to extract the longpoll URL. +- Check for submitold flag on resubmit of shares, and give different message for +stale shares on retry. +- Check for submitold before submitstale. +- Don't force fresh curl connections on anything but longpoll threads. +- Create one longpoll thread per pool, using backup pools for those pools that +don't have longpoll. +- Use the work created from the longpoll return only if we don't have +failover-enabled, and only flag the work as a longpoll if it is the current +pool. +- This will work around the problem of trying to restart the single longpoll +thread on pool changes that was leading to race conditions. +- It will also have less work restarts from the multiple longpolls received from +different pools. +- Remove the invalid entries from the example configuration file. +- Add support for latest ATI SDK on windows. +- Export missing function from libztex. +- miner.php change socktimeoutsec = 10 (it only waits once) +- Bugfix: Make initial_args a const char** to satisfy exec argument type warning +(on Windows only) +- miner.php add a timeout so you don't sit and wait ... forever +- Create discrete persistent submit and get work threads per pool, thus allowing +all submitworks belonging to the same pool to reuse the same curl handle, and +all getworks to reuse their own handle. +- Use separate handles for submission to not make getwork potentially delay +share submission which is time critical. +- This will allow much more reusing of persistent connections instead of opening +new ones which can flood routers. +- This mandated a rework of the extra longpoll support (for when pools are +switched) and this is managed by restarting longpoll cleanly and waiting for a +thread join. +- miner.php only show the current date header once +- miner.php also add current time like single rig page +- miner.php display rig 'when' table at top of the multi-rig summary page +- README - add some Ztex details +- api.c include zTex in the FPGA support list +- api.c ensure 'devs' shows PGA's when only PGA code is compiled +- miner.c sharelog code consistency and compile warning fix +- README correct API version number +- README spelling error +- api.c combine all pairs of sprintfs() +- api.c uncomment and use BLANK (and COMMA) +- Code style cleanup +- Annotating frequency changes with the changed from value +- README clarification of 'notify' command +- README update for API RPC 'devdetails' +- api.c 'devdetails' list static details of devices +- Using less heap space as my TP-Link seems to not handle this much + + +BFGMiner Version 2.3.4 - April 26, 2012 + +- New maintainership of code with modular FPGA/GPU focus, under BFGMiner name +- Complete working support for cross-compiling Windows builds on Linux. +- Fix usage of low --scan-time settings so it doesn't busy-loop +- JSON API: Add new 'devdetail' command to get fixed device information +- JSON API: Implement driver abstraction for extra device status +- Icarus: Use epoll to wait for serial port input properly, when available +- Icarus: Workaround buggy USB-UART that causes Icarus to stop mining rarely +- Icarus: Estimate mining hashrate correctly, calibrated from real-world data +- Icarus: Parallelize work setup with Icarus hash search improving performance +- Icarus: More reliable detection and runtime +- OpenCL: Move GPU-specific data fetching from JSON API to OpenCL driver +- OpenCL: Dynamically load OpenCL library, to be more vendor-independent and +allow use without actually having OpenCL (i.e. FPGA-only rigs). + + +CGMiner Version 2.3.4 - April 25, 2012 + +- Extensively document the cause of GPU device issues and the use of --gpu-map. +- Support for share logging +- Detect poorly performing combination of SDK and phatk kernel and add verbose +warning at startup. +- Icarus update to new add_cgpu() +- Icarus driver working with Linux and Windows +- api.c fix unused variable compile warning +- Display all OpenCL devices when -n is called as well to allow debugging of +differential mapping of OpenCL to ADL. +- Add a --gpu-map option which will allow arbitrarily mapping ADL devices to +OpenCL devices for instances where association by enumeration alone fails. +- Increase upper limit on number of extra items to queue as some FPGA code can't +yet reliably keep many devices busy. +- Display configuration file information when -c option is passed and only when +file exists on loading default config file. +- Display configuration file loaded, if any, and debug output if configuration +file parsing failed. +- Add missing ztex header to Makefile for distribution. +- Document long-form COM port device names on Windows, required to specify +serial ports above 9 +- Include ztex bitstreams firmware in distribution and install if configured in. +- Style police on driver-ztex.c +- work_restart should only be changed by cgminer.c now +- Shut down the api cleanly when the api thread is cancelled. This should allow +the api socket to be closed successfully to next be reopened with app_restart. +- Make a union for cgpu device handles, and rename "device" to "device_ztex" +since it's Ztex-specific +- Initialise name variable. +- Remove unnecessary check for variable that always has memory allocated. +- Bugfix: Missing "break" no-op in default case +- Make the status window and log window as large as can fit on startup, +rechecking to see if it can be enlarged after the fact. This allows any number +of devices to be displayed provided the window is made long enough without +corrupting the output. +- Style police on libztex.c. +- API add removepool like the screen interface +- api.c escape required characters in return strings + pools returns the +username +- Set lp_path to NULL after free for consistency. +- Removing dmalloc import left behind by mistake +- Fixing leak in resp_hdr_cb +- miner.php warning highlight GPU stats if they are zero (e.g. ADL not enabled) +- miner.php highlight any device that isn't 'Enabled' +- miner.php highlight any Status that isn't 'Alive' +- miner.php optionally support multiple rigs +- Initial Ztex support 1.15x board. + + +CGMiner Version 2.3.3 - April 15, 2012 + +- Don't even display that cpumining is disabled on ./configure to discourage +people from enabling it. +- Do a complete cgminer restart if the ATI Display Library fails, as it does on +windows after running for some time, when fanspeed reporting fails. +- Cache the initial arguments passed to cgminer and implement an attempted +restart option from the settings menu. +- Disable per-device status lines when there are more than 8 devices since +screen output will be corrupted, enumerating them to the log output instead at +startup. +- Reuse Vals[] array more than W[] till they're re-initialised on the second +sha256 cycle in poclbm kernel. +- Minor variable alignment in poclbm kernel. +- Make sure to disable devices with any status not being DEV_ENABLED to ensure +that thermal cutoff code works as it was setting the status to DEV_RECOVER. +- Re-initialising ADL simply made the driver fail since it is corruption over +time within the windows driver that's responsible. Revert "Attempt to +re-initialise ADL should a device that previously reported fanspeed stops +reporting it." +- Microoptimise poclbm kernel by ordering Val variables according to usage +frequency. + + +CGMiner Version 2.3.2 - March 31, 2012 + +- Damping small changes in hashrate so dramatically has the tendency to always +make the hashrate underread so go back to gentle damping instead. +- Revert the crossover of variables from Vals to W in poclbm kernel now that +Vals are the first declared variables so they're used more frequently. +- Vals variables appearing first in the array in poclbm is faster. +- Change the preferred vector width to 1 for Tahiti only, not all poclbm +kernels. +- Use a time constant 0.63 for when large changes in hashrate are detected to +damp change in case the large change is an aliasing artefact instead of a real +chang +- Only increment stale counter if the detected stales are discarded. +- Attempt to re-initialise ADL should a device that previously reported fanspeed +stops reporting it. +- Move the ADL setup and clearing to separate functions and provide a reinit_adl +function to be used when adl fails while running. +- Use slightly more damping on the decay time function in the never-ending quest +to smooth off the hashmeter. +- Set the starting fanspeed to a safe and fairly neutral 50% when autofan is +enabled. +- Provide locking around updates of cgpu hashrates as well to prevent multiple +threads accessing data fields on the same device. +- Display the beginning of the new block in verbose mode in the logs. +- Reinstate old diablo kernel variable ordering from 120222, adding only goffset +and vector size hint. The massive variable ordering change only helped one SDK +on +- Change the version number on the correct kernels. +- api.c devicecode/osinfo incorrectly swapped for json +- Add extensive instructions on how to make a native windows build. +- Update version numbers of poclbm and diablo kernels as their APIs have also +changed. +- Use global offset parameter to diablo and poclbm kernel ONLY for 1 vector +kernels. +- Use poclbm preferentially on Tahiti now regardless of SDK. +- Remove unused constant passed to poclbm. +- Clean up use of macros in poclbm and use bitselect everywhere possible. +- Add vector type hint to diablo kernel. +- Add worksize and vector attribute hints to the poclbm kernel. +- Spaces for non-aligned variables in poclbm. +- Swap Vals and W variables where they can overlap in poclbm. +- More tidying of poclbm. +- Tidy up first half of poclbm. +- Clean up use of any() by diablo and poclbm kernels. +- Minor variable symmetry changes in poclbm. +- Put additions on separate lines for consistency in poclbm. +- Consolidate last use of W11 into Vals4 in poclbm. +- Change email due to SPAM +- api.c miner.php add a '*' to the front of all notify counters - simplifies +future support of new counters +- miner.php add display 'notify' command +- Small change to help arch's without processor affinity +- Fix bitforce compile error +- api.c notify should report disabled devices also - of course +- API returns the simple device history with the 'notify' command +- code changes for supporting a simple device history +- api.c Report an OS string in config to help with device issues +- api.c fix Log Interval - integer in JSON +- api.c config 'Device Code' to show list of compiled devices + README +- api.c increase buffer size close to current code allowable limit +- removed 8-component vector support from kernel, as this is not supported in +CGMINER anyway +- forgot to update kernel modification date, fixed ;) +- reordered an addition in the kernel, which results in less instructions used +in the GPU ISA code for GCN +- miner.php: option for readonly or check privileged access +- Ignore reduntant-with-build options --disable-gpu, --no-adl, and --no-restart +- miner.php: ereg_replace is DEPRECATED so use preg_replace instead +- Make curses TUI support optional at compile-time. +- Bugfix: AC_ARG_WITH provides withval instead of enableval +- miner.php split devs output for different devices +- api.c: correct error messages +- icarus.c modify (regular) timeout warning to only be debug +- icarus.c set the windows TODO timeout +- Allow specifying a specific driver for --scan-serial +- optimized nonce-check and output code for -v 2 and -v 4 +- Bugfix: Check for libudev header (not just library) in configure, and document +optional dependency +- Add API support for Icarus and Bitforce +- Next API version is 1.4 (1.3 is current) +- README/api.c add "When" the request was processed to STATUS +- Bugfix: ZLX to read BitFORCE temp, not ZKX -.- +- Use libudev to autodetect BitFORCE GPUs, if available +- Use the return value of fan_autotune to set fan_optimal instead of passing it +as a pointer. +- Pass the lasttemp from the device we're using to adjust fanspeed in twin +devices. +- fix the name to 3 chars, fix the multi-icarus support +- Bugfix: "-S auto" is the default if no -S is specified, and there is no such +delay in using it +- README add information missing from --scan-serial +- Update README RPC API Version comment +- Bugfix: Allow enabling CPU even without OpenCL support +- Change failed-to-mine number of requested shares messge to avoid segfault on +recursive calling of quit(). +- Get rid of extra char which is just truncated in poclbm kernel. +- only small code formating changes +- removed vec_step() as this could lead to errors on older SDKs +- unified code for generating nonce in kernel and moved addition of base to the +end -> faster + +CGMiner Version 2.3.1 - February 24, 2012 + +- Revert input and output code on diakgcn and phatk kernels to old style which +worked better for older hardware and SDKs. +- Add a vector*worksize parameter passed to those kernels to avoid one op. +- Increase the speed of hashrate adaptation. +- Only send out extra longpoll requests if we want longpolls. +- API implement addpool command +- API return the untouched Total MH also (API now version 1.3) +- Add enable/disablepool to miner.php example and reduce font size 1pt + + +CGMiner Version 2.3.0 - February 23, 2012 + +- Consider extra longpoll work items as staged_extra so as to make sure we queue +more work if queueing regular work items as longpolls. +- Use diablo kernel on all future SDKs for Tahiti and set preferred vector width +to 1 on poclbm kernel only. +- Explicitly type the constants in diakgcn kernel as uint, to be in line with +poclbm kernel. +- Reset all hash counters at the same time as resetting start times to get +accurate hashrates on exiting which is mandatory for benchmarking. +- Report thread out before it starts to avoid being flagged as sick when waiting +for the first work item. +- Don't disable and re-enable devices as they may recover and in the meantime +have their status set to OFF. +- API new commands enablepool and disablepool (version already incremented) +- Tolerate new-format temperature readings for bitforce +- Modify cgminer.c pool control to allow API to call it +- Bugfix: Fix BitFORCE driver memory leak in debug logging +- Extra byte was being unused in poclbm leading to failure on some platforms. +- Explicitly type the constants in poclbm kernel as uint. +- Don't save 'include' when saving the configuration +- Allow configuration file to include another recursively +- Use the SDK and hardware information to choose good performing default +kernels. +- Move phatk kernel to offset vector based nonce bases as well. +- Add a --benchmark feature which works on a fake item indefinitely to compare +device performance without any server or networking influence. +- Allow writing of multiple worksizes to the configuration file. +- Allow writing of multiple vector sizes to the configuration file. +- Allow writing of multiple kernels to the configuration file. +- Allow multiple different kernels to be chosen per device. +- Allow the worksize to be set per-device. +- Allow different vectors to be set per device. +- If we're well below the target temperature, increase gpu engine speed back to +maximum in case we have gotten lost between profiles during an idle period. +- We should be setting the value of fan_optimal, not its address. +- As all kernels will be new versions it's an opportunity to change the .bin +format and make it simpler. Specifying bitalign is redundant and long can be l. +- Use any() in kernel output code. +- Put the nonce for each vector offset in advance, avoiding one extra addition +in the kernel. +- Reset times after all mining threads are started to make estimating hashrates +easier at startup. +- Bugfix: allow no-exec (NX) stack +- Fix minor warning. +- fix the bitforce.c code style follow 1TBS +- fix icarus.c compile warning +- small changes to speedup no vec for AMD 898.1 OCL runtime +- Update licensing to GPL V3. +- Reset the longpoll flag after it's been used once to prevent it restarting +work again. +- Begin import of DiabloMiner kernel. +- Modify API debug messages to say API instead of DBG +- When API shuts down cgminer don't kill itself +- Don't make rolled work from the longpoll be seen as other longpoll work items. +- API add 'privileged' command so can verify access level +- Set the lp_sent variable under lock since there will almost always be a race +on setting this variable, potentially leading to multiple LPs being sent out. +- API restrict access to all non display commands by default +- Update API version to 1.2 for new 'Log Interval' +- API add --log Interval to 'config' reply +- --api-allow special case 0/0 means all + + +CGMiner Version 2.2.7 - February 20, 2012 + +- Send out extra longpolls when we have switched pools and the longpoll thread +is still bound to the old one. This is particularly useful with p2pool where +longpolls do not correlate with main bitcoin block change and would have led to +high reject rates on failover. +- Store whether a work item is the result of a longpoll or not in struct work +and use it to help determine block changes directly from the work longpoll bool. +- Keep track of when a longpoll has been sent for a pool and if the current pool +is requesting work but has not sent a longpoll request, convert one of the work +items to a longpoll. +- Store the longpoll url in the pool struct and update it from the pool_active +test in case it changes. This is to allow further changes to longpoll management +on switching pools. +- Re-check for a longpoll supporting pool every 30 seconds if none is found +initially. +- Report threads as busy waiting on getwork on startup to avoid them being +flagged sick on startup during slow networking. +- Allow devices that are disabled due to overheating to be flagged as recovering +instead of disabling them and re-enable them if they're below ideal temperatures +- Tahiti prefers worksize 64 with poclbm. +- No need to expressly retain the opencl program now that the zero binary issue +is fixed. This actually fixes cgminer to work with the latest SDK included with +the ATI catalyst driver 12.2. +- Show error code on any opencl failure status. +- Add detection for version 898.1 SDK as well but only give SDK 2.6 warning once +on startup instead of with each device initialisation. +- Always use a fresh connection for longpoll as prolonged persistent connections +can fail for many reasons. +- Keep track of intended engine clock speed and only adjust up if it's higher +than the last intended speed. This avoids setting the clock speed to one +relative to a lower profile one by mistake. +- Use gpu-memdiff on startup if an engine clockspeed is set and a memdiff value +is set. +- Revert "Adjust engine speed up according to performance level engine setting, +not the current engine speed." - ineffectual. +- Freeze the queues on all threads that are sent the pause message to prevent +them trying to start up again with saved pings in their queues. +- Updates to diakgcn kernel/ +- Consolidate all screen updates to the watchdog thread and touch both windows +before refresh. +- Curses will be disabled in clean_up so don't do it early in kill_work, and +disable_adl so that GPU settings may be restored to normal in case shutting down +curses leads to instability on windows. +- Stop the mining threads before trying to kill them. +- Plain refresh() does not give reliably screen updates so get rid of all uses +of it. +- First release with working diakgcn kernel. + +CGMiner Version 2.2.6 - February 16, 2012 + +- Provide warning on each startup about sdk 2.6 +- Fix unused warnings on win32. +- bitforce: Simplify BFopen WIN32 ifdef/else +- Fix initialization warning with jansson 1.3 +- bitforce: Cleanup extraneous TODO that isn't needed +- Move tcsetattr (and new tcflush) into *nix BFopen to simplify things a bit +- Add message explaining 2nd thread disabling for dynamic mode and how to tune +it. +- Move logwindow down once number of devices is known. +- Automatically choose phatk kernel for bitalign non-gcn ATI cards, and then +only select poclbm if SDK2.6 is detected. +- Allow the refresh interval to be adjusted in dynamic intensity with a +--gpu-dyninterval parameter. +- Make curses display visible right from the beginning and fix the window sizes +so the initial messages don't get lost once the status window is drawn. +- The amount of work scanned can fluctuate when intensity changes and since we +do this one cycle behind, we increment the work more than enough to prevent +repeati +- bitforce: Set a 30 second timeout for serial port on Windows, since the +default is undefined +- Use PreVal4addT1 instead of PreVal4 in poclbm kernel. +- Import PreVal4 and PreVal0 into poclbm kernel. +- Import more prepared constants into poclbm kernel. +- Keep variables in one array but use Vals[] name for consistency with other +kernel designs. +- Replace constants that are mandatorily added in poclbm kernel with one value. +- Remove addition of final constant before testing for result in poclbm kernel. +- Hand optimise variable addition order. +- Hand optimise first variable declaration order in poclbm kernel. +- Radical reordering machine based first pass to change variables as late as +possible, bringing their usage close together. +- fix strcpy NULL pointer if env HOME unset. +- bitforce: Disable automatic scanning when at least one device is specified +manually +- Unroll all poclbm additions to enable further optimisations. + + +CGMiner Version 2.2.5 - February 13, 2012 + +- Make output buffer write only as per Diapolo's suggestion. +- Constify nonce in poclbm. +- Use local and group id on poclbm kernel as well. +- Microoptimise phatk kernel on return code. +- Adjust engine speed up according to performance level engine setting, not the +current engine speed. +- Try to load a binary if we've defaulted to the poclbm kernel on SDK2.6 +- Use the poclbm kernel on SDK2.6 with bitalign devices only if there is no +binary available. +- Further generic microoptimisations to poclbm kernel. +- The longstanding generation of a zero sized binary appears to be due to the +OpenCL library putting the binary in a RANDOM SLOT amongst 4 possible binary +locations. Iterate over each of them after building from source till the real +binary is found and use that. +- Fix harmless warnings with -Wsign-compare to allow cgminer to build with -W. +- Fix missing field initialisers warnings. +- Put win32 equivalents of nanosleep and sleep into compat.h fixing sleep() for +adl.c. +- Restore compatibility with Jansson 1.3 and 2.0 (api.c required 2.1) +- Modularized logging, support for priority based logging +- Move CPU chipset specific optimization into device-cpu + + +CGMiner Version 2.2.4 - February 11, 2012 + +- Fix double definition of A0 B0 to zeroA zeroB. +- Retain cl program after successfully loading a binary image. May decrease +failures to build kernels at startup. +- Variable unused after this so remove setting it. +- BFI INT patching is not necessarily true on binary loading of files and not +true on ATI SDK2.6+. Report bitalign instead. +- Various string fixes for reject reason. +- Generalize --temp-cutoff and implement support for reading temperature from +BitFORCE FPGAs +- Change message from recovered to alive since it is used on startup as well as +when a pool has recovered. +- Start mining as soon as any pool is found active and rely on the watchpool +thread to bring up other pools. +- Delayed responses from testing pools that are down can hold up the watchdog +thread from getting to its device testing code, leading to false detection of +the GPU not checking in, and can substantially delay auto gpu/auto fan +management leading to overheating. Move pool watching to its own thread. +- Bugfix: BitFORCE index needs to be static to count correctly +- Space out retrieval of extra work according to the number of mining threads. +- Make shutdown more robust. Enable the input thread only after the other +threads exist. Don't kill off the workio thread and use it to exit main() only +if there is an unexpected problem. Use kill_work() for all anticipated shutdowns +where possible. Remove unused thread entry. +- Change poclbm version number. +- One array is faster than 2 separate arrays so change to that in poclbm kernel. +- Microoptimisations to poclbm kernel which increase throughput slightly. +- Import diablominer kernel. Currently disabled as not working. +- Import diapolo kernel. Currently disabled as not working. +- Conflicting entries of cl_kernel may have been causing problems, and +automatically chosen kernel type was not being passed on. Rename the enum to +cl_kernels and store the chosen kernel in each clState. +- Set cl_amd_media_ops with the BITALIGN flag and allow non-bitselect devices to +build. +- ALlow much longer filenames for kernels to load properly. +- Allow different kernels to be used by different devices and fix the logic fail +of overcorrecting on last commit with !strstr. +- Fix kernel selection process and build error. +- queue_phatk_kernel now uses CL_SET_VARG() for base-nonce(s), too +- added OpenCL >= 1.1 detection code, in preparation of OpenCL 1.1 global offset +parameter support +- Use K array explicitly to make it clear what is being added. +- Work items have a tendency to expire at exactly the same time and we don't +queue extra items when there are plenty in the queue, regardless of age. Allow +extra work items to be queued if adequate time has passed since we last +requested work even if over the limit. +- Discard work when failover-only is enabled and the work has come from a +different pool. +- Missing include to build on newer mingw32. +- Move from the thread safe localtime_r to regular localtime which is the only +one supported on newer pthread libraries on mingw32 to make it compile with the +newer ming. Thread safety is of no importance where localtime is used in this +code. +- Define in_addr_t in windows if required +- sys/wait.h not required in windows +- Allow API to restrict access by IP address +- Add pool switching to example miner.php +- Display X-Reject-Reason, when provided +- Remove the test for whether the device is on the highest profil level before +raising the GPU speed as it is ineffectual and may prevent raising the GPU +speed. +- Remove unnecessary check for opt_debug one every invocation of applog at +LOG_DEBUG level and place the check in applog(). + + +CGMiner Version 2.2.3 - February 6, 2012 + +- Revert "Rewrite the convoluted get_work() function to be much simpler and roll +work as much as possible with each new work item." This seems to cause a race on +work in free_work(). Presumably other threads are still accessing the structure. + + +CGMiner Version 2.2.2 - February 6, 2012 + +- Provide support for the submitold extension on a per-pool basis based on the +value being detected in a longpoll. +- Don't send a ping to a dynamic device if it's not enabled as that will just +enable it for one pass and then disable it again. +- Rewrite the convoluted get_work() function to be much simpler and roll work as +much as possible with each new work item. +- Roll as much work as possible from the work returned from a longpoll. +- Rolling work on each loop through the mining thread serves no purpose. +- Allow to stage more than necessary work items if we're just rolling work. +- Replace divide_work with reuse_work function used twice. +- Give rolled work a new ID to make sure there is no confusion in the hashtable +lookups. +- Remove now-defunct hash_div variables. +- Remove unused get_dondata function. +- Silence ADL warnings. +- Silence unused parameter warnings. +- Stagger the restart of every next thread per device to keep devices busy ahead +of accessory threads per device. +- Deprecate the --donation feature. Needlessly complex, questionable usefulness, +depends on author's server and a central pool of some kind, and was not heavily +adopted. +- It's devices that report back now, not threads, update message. +- Continue auto-management of fan and engine speeds even if a device is disabled +for safety reasons. +- No need to check we're highest performance level when throttling GPU engine +speed. +- Abstract out tests for whether work has come from a block that has been seen +before and whether a string is from a previously seen block. +- Probe but don't set the timeout to 15 seconds as some networks take a long +time to timeout. +- Remove most compiler warnings from api.c +- Add last share's pool info in cgpu_info +- Allow the OpenCL platform ID to be chosen with --gpu-platform. +- Iterate over all platforms displaying their information and number of devices +when --ndevs is called. +- Deprecate main.c +- Some networks can take a long time to resolve so go back to 60 second timeouts +instead of 15. +- Only enable curses on failure if curses is desired. +- Fix warnings in bitforce.c +- Bugfix: Need to open BitForce tty for read-write +- Fix various build issues. +- Modularize code: main.c -> device-cpu + device-gpu +- Fix phatk kernel not working on non-bitalign capable devices (Nvidia, older +ATI). +- Update poclbm kernel for better performance on GCN and new SDKs with bitalign +support when not BFI INT patching. Update phatk kernel to work properly for non +BFI INT patched kernels, providing support for phatk to run on GCN and non-ATI +cards. +- Return last accepted share pool/time for devices +- Display accepted share pool/time for CPUs +- Bug intensity always shows GPU 0 +- Update example web miner.php to use new API commands + + +CGMiner Version 2.2.1 - January 30, 2012 + +NOTE - The GPU Device reordering in 2.2.0 by default was considered a bad idea +so the original GPU ordering is used by default again unless reordering is +explicitly requested. + +- Fix bitforce failing to build into cgminer. +- Add missing options to write config function. +- Add a --gpu-reorder option to only reorder devices according to PCI Bus ID +when requested. +- Fix for midstate support being broken on pools that supported no-midstate +work by ensuring numbers are 32 bits in sha2.c +- Set virtual GPUs to work when ADL is disabled or all mining will occur on GPU +0. +- Add information about paused threads in the menu status. +- Disable all but the first thread on GPUs in dynamic mode for better +interactivity. +- Set the latest network access time on share submission for --net-delay even if +we're not delaying that submission for further network access. +- Clear adl on exiting after probing values since it may attempt to overclock. +- As share submission is usually staggered, and delays can be costly, submit +shares without delay even when --net-delay is enabled. +- Display GPU number and device name when ADL is successfully enabled on it. +- Display GPU ordering remapping in verbose mode. +- Don't fail in the case the number of ADL and OpenCL devices do not match, and +do not attempt to reorder devices unless they match. Instead give a warning +about +- Display error codes should ADL not return ADL_OK in the more critical function +calls. +- Fix unused warning. +- Fix compile warnings in api.c +- Add extensive ADL based device info in debug mode. +- Make --ndevs display verbose opencl information as well to make debugging +version information easier. +- Display information about the opencl platform with verbose enabled. +- Explicitly check for nvidia in opencl platform strings as well. + + +CGMiner Version 2.2.0 - January 29, 2012 + +NOTE: GPU Device order will change with this release with ATI GPUs as cgminer +now can enumerate them according to their Bus ID which means the values should +now correlate with their physical position on the motherboard. + +- Default to poclbm kernel on Tahiti (7970) since phatk does not work, even +though performance is sub-standard so that at least it will mine successfully by +defau +- Retain cl program after every possible place we might build the program. +- Update ADL SDK URL. +- Fix potential overflow. +- Map GPU devices to virtual devices in their true physical order based on +BusNumber. +- Change the warning that comes with failure to init cl on a device to be more +generic and accurate. +- Advertise longpoll support in X-Mining-Extensions +- Detect dual GPU cards by iterating through all GPUs, finding ones without +fanspeed and matching twins with fanspeed one bus ID apart. +- Do not attempt to build the program that becomes the kernel twice. This could +have been leading to failures on initialising cl. +- Some opencl compilers have issues with no spaces after -D in the compiler +options. +- Allow intensity up to 14. +- Use calloced stack memory for CompilerOptions to ensure sprintf writes to the +beginning of the char. +- Whitelist 79x0 cards to prefer no vectors as they perform better without. +- Adjust fan speed gently while in the optimal range when temperature is +drifting to minimise overshoot in either direction. +- Detect dual GPU cards via the indirect information of - 1st card has a fan +controller. 2nd card does not have a fan controller, cards share the same device +name +- Instead of using the BFI_INT patching hack on any device reporting +cl_amd_media_ops, create a whitelist of devices that need it. This should enable +GCN architec +- Fixed API compiling issue on OS X +- Add more explanation of JSON format and the 'save' command +- Return an error if using ADL API commands when it's not available +- Read off lpThermalControllerInfo from each ADL device. +- Add ADL_Overdrive5_ThermalDevices_Enum interface. +- Add API commands: config, switchpool, gpu settings, save +- Implement socks4 proxy support. +- Fix send() for JSON strings +- Introduce a --net-delay option which guarantees at least 250ms between any +networking requests to not overload slow routers. +- Generalise locking init code. +- Allow invalid values to be in the configuration file, just skipping over them +provided the rest of the file is valid JSON. This will allow older configurat +- Allow CPU mining explicitly enable only if other mining support is built in. +- BitForce FPGA support +- Configure out building and support of all CPU mining code unless +--enable-cpumining is enabled. +- Allow parsed values to be zero which will allow 0 values in the config file to +work. +- Advertise that we can make our own midstate, so the pool can skip generating +it for us +- Refactor the CPU scanhash_* functions to use a common API. Fixes bugs. +- Don't consider a pool lagging if a request has only just been filed. This +should decrease the false positives for "pool not providing work fast enough". +- Invalidating work after longpoll made hash_pop return no work giving a false +positive for dead pool. Rework hash_pop to retry while finds no staged work u +- Remove TCP_NODELAY from curl options as many small packets may be contributing +to network overload, when --net-delay is enabled. +- Refactor miner_thread to be common code for any kind of device +- Simplify submit_nonce loop and avoid potentially missing FOUND - 1 entry. +Reported by Luke-Jr. +- Micro-optimisation in sha256_sse2 code courtesy of Guido Ascioti +guido.ascioti@gmail.com +- Refactor to abstract device-specific code + + +CGMiner Version 2.1.2 - January 6, 2012 + +- If api-description is specified, save it when writing the config file +- Adjust utility width to be constant maximum as well. +- Add percent signs to reject ratio outputs +- Should the donation pool fail, don't make the fallover pool behave as though +the primary pool is lagging. +- Use an alternative pool should the donation getwork fail. + + +CGMiner Version 2.1.1 - January 1, 2012 + +- Include API examples in distribution tarball. +- Don't attempt to pthread_join when cancelling threads as they're already +detached and doing so can lead to a segfault. +- Give more generic message if slow pool at startup is the donation pool. +- Continue to attempt restarting GPU threads if they're flagged dead at 1 min. +intervals. +- Don't attempt to restart sick flagged GPUs while they're still registering +activity. +- Make curl use fresh connections whenever there is any communication issue +in case there are dead persistent connections preventing further comms from +working. +- Display pool in summary if only 1 pool. +- Adjust column width of A/R/HW to be the maximum of any device and align them. + + +CGMiner Version 2.1.0 - December 27, 2011 + +- Major infrastructure upgrade with RPC interface for controlling via sockets +encoded with/without JSON courtesy of Andrew Smith. Added documentation for +use of the API and sample code to use with it. +- Updated linux-usb-cgminer document. +- Rewrite of longpoll mechanism to choose the current pool wherever possible to +use for the longpoll, or any pool that supports longpoll if the current one +does not. +- Display information about longpoll when the chosen server has changed. +- Fix the bug where longpoll generated work may have been sent back to the +wrong pool, causing rejects. +- Fix a few race conditions on closing cgminer which caused some of the crashes +on exit. +- Only adjust gpu engine speed in autotune mode if the gpu is currently at the +performance level of that being adjusted. +- Various fixes for parsing/writing of configuration files. +- Do not add blank lines for threads of unused CPUs. +- Show which pool is unresponsive on startup. +- Only show GPU management menu item if GPUs are in use. +- Align most device columns in the curses display. + + +CGMiner Version 2.0.8 - November 11, 2011 + +- Make longpoll do a mandatory flushing of all work even if the block hasn't +changed, thus supporting longpoll initiated work change of any sort and merged +mining. +- Byteswap computed hash in hashtest so it can be correctly checked. This fixes +the very rare possibility that a block solve on solo mining was missed. +- Add x86_64 w64 mingw32 target +- Allow a fixed speed difference between memory and GPU clock speed with +--gpu-memdiff that will change memory speed when GPU speed is changed in +autotune mode. +- Don't load the default config if a config file is specified on the command +line. +- Don't build VIA on apple since -a auto bombs instead of gracefully ignoring +VIA failing. +- Build fix for dlopen/dlclose errors in glibc. + + +CGMiner Version 2.0.7 - October 17, 2011 + +- Support work without midstate or hash1, which are deprecated in bitcoind 0.5+ +- Go to kernel build should we fail to clCreateProgramWithBinary instead of +failing on that device. This should fix the windows problems with devices not +initialising. +- Support new configuration file format courtesy of Chris Savery which can write +the config file from the menu and will load it on startup. +- Write unix configuration to .cgminer/cgminer.conf by default and prompt to +overwrite if given a filename from the menu that exists. + + +CGMiner Version 2.0.6 - October 9, 2011 + +- Must initialise the donorpool mutex or it fails on windows. +- Don't make donation work interfere with block change detection allowing +donation to work regardless of the block chain we're mining on. +- Expire shares as stale with a separate timeout from the scantime, defaulting +to 120 seconds. +- Retry pools after a delay of 15 seconds if none can be contacted on startup +unless a key is pressed. +- Don't try to build adl features without having adl. +- Properly check shares against target difficulty - This will no longer show +shares when solo mining at all unless they're considered to be a block solve. +- Add altivec 4 way (cpu mining) support courtesy of Gilles Risch. +- Try to use SSL if the server supports it. +- Display the total solved blocks on exit (LOL if you're lucky). +- Use ADL activity report to tell us if a sick GPU is still busy suggesting it +is hard hung and do not attempt to restart it. + + +CGMiner Version 2.0.5 - September 27, 2011 + +- Intensity can now be set to dynamic or static values per-device. +- New donation feature --donation sends a proportion of shares to author's +account of choice, but is disabled by default! +- The hash being displayed and block detection has been fixed. +- Devices not being mined on will not attempt to be ADL managed. +- Intensity is now displayed per GPU device. +- Make longpoll attempt to restart as often as opt_retries specifies. +- We weren't rolling work as often as we could. +- Correct some memory management issues. +- Build fixes. +- Don't mess with GPUs if we don't have them. + + +CGMiner Version 2.0.4 - September 23, 2011 + +- Confused Longpoll messages should be finally fixed with cgminer knowing for +sure who found the new block and possibly avoiding a rare crash. +- Display now shows the actual hash and will say BLOCK! if a block is deemed +solved. +- Extra spaces, which would double space lines on small terminals, have been +removed. +- Fan speed change is now damped if it is already heading in the correct +direction to minimise overshoot. +- Building without opencl libraries is fixed. +- GPUs are autoselected if there is only one when in the GPU management menu. +- GPU menu is refreshed instead of returning to status after a GPU change. + + +CGMiner Version 2.0.3 - September 17, 2011 + +- Various modes of failure to set fanspeeds and adl values have been addressed +and auto-fan should work now on most hardware, and possibly other values +which previously would not have worked. +- Fixed a crash that can occur on switching pools due to longpoll thread races. +- Use ATISTREAMSDKROOT if available at build time. +- Fanspeed management is returned to the driver default on exit instead of +whatever it was when cgminer was started. +- Logging of events deemed WARNING or ERR now will display even during +periods where menu input is being awaited on. + + +CGMiner Version 2.0.2 - September 11, 2011 + +- Exit cleanly if we abort before various threads are set up or if they no +longer exist. +- Fix a rare crash in HASH_DEL due to using different mutexes to protect the +data. +- Flag devices that have never started and don't allow enabling of devices +without restarting them. +- Only force the adapter speed to high if we've flagged this device as being +managed. +- Flag any devices with autofan or autogpu as being managed. +- Use a re-entrant value to store what fanspeed we're trying to set in case the +card doesn't support small changes. Force it to a multiple of 10% if it +fails on trying to speed up the fan. +- Do not bother resetting values to old ones if changes to GPU parameters report +failure, instead returning a failure code only if the return value from get() +differs. +- Remove redundant check. +- Only display supported values from fanspeed on change settings. +- Missing bracket from output. +- Display fan percentage on devices that only support reporting percent and not +RPM. +- Properly substitute DLOPEN flags to build with ADL support when -ldl is needed +and not when opencl is not found. + + +CGMiner Version 2.0.1 - September 9, 2011 + +- Fix building on 32bit glibc with dlopen with -lpthread and -ldl +- ByteReverse is not used and the bswap opcode breaks big endian builds. Remove +it. +- Ignore whether the display is active or not since only display enabled devices +work this way, and we skip over repeat entries anwyay. +- Only reset values on exiting if we've ever modified them. +- Flag adl as active if any card is successfully activated. +- Add a thermal cutoff option as well and set it to 95 degrees by default. +- Change the fan speed by only 5% if it's over the target temperature but less +than the hysteresis value to minimise overshoot down in temperature. +- Add a --no-adl option to disable ADL monitoring and GPU settings. +- Only show longpoll received delayed message at verbose level. +- Allow temperatures greater than 100 degrees. +- We should be passing a float for the remainder of the vddc values. +- Implement accepting a range of engine speeds as well to allow a lower limit to +be specified on the command line. +- Allow per-device fan ranges to be set and use them in auto-fan mode. +- Display which GPU has overheated in warning message. +- Allow temperature targets to be set on a per-card basis on the command line. +- Display fan range in autofan status. +- Setting the hysteresis is unlikely to be useful on the fly and doesn't belong +in the per-gpu submenu. +- With many cards, the GPU summaries can be quite long so use a terse output +line when showing them all. +- Use a terser device status line to show fan RPM as well when available. +- Define max gpudevices in one macro. +- Allow adapterid 0 cards to enumerate as a device as they will be non-AMD +cards, and enable ADL on any AMD card. +- Do away with the increasingly confusing and irrelevant total queued and +efficiency measures per device. +- Only display values in the log if they're supported and standardise device log +line printing. + + +CGMiner Version 2.0.0 - September 6, 2011 + +Major feature upgrade - GPU monitoring, (over)clocking and fan control for ATI +GPUs. + +New command line switches: +--auto-fan- Automatically adjust all GPU fan speeds to maintain a target +temperature +--auto-gpu- Automatically adjust all GPU engine clock speeds to maintain +a target temperature +--gpu-engine Set the GPU engine (over)clock in Mhz - one value for all or +separate by commas for per card. +--gpu-fan Set the GPU fan percentage - one value for all or separate +by commas for per card. +--gpu-memclock Set the GPU memory (over)clock in Mhz - one value for all +or separate by commas for per card. +--gpu-powertune Set the GPU powertune percentage - one value for all or +separate by commas for per card. +--gpu-vddc Set the GPU voltage in Volts - one value for all or separate +by commas for per card. +--temp-hysteresis Set how much the temperature can fluctuate outside +limits when automanaging speeds (default: 3) +--temp-overheat Set the overheat temperature when automatically managing +fan and GPU speeds (default: 85) +--temp-target Set the target temperature when automatically managing fan +and GPU speeds (default: 75) + +- Implement ATI ADL support for GPU parameter monitoring now and setting later +(temp, fan, clocks etc.). +- Check for the presence of the ADL header files in ADL_SDK. +- Import adl_functions.h from amd overdrive ctrl. +- Implement a setup function that tries to detect GPUs that support the ADL and +link in the parameters into the gpus struct. +- Put a summary of monitoring information from the GPU menu. +- Implement changing memory speed and voltage on the fly. +- Implement fan speed setting. +- Minor corrections to set fan speed by percentage. +- Make sure to read off the value in RPM only. +- Implement auto fanspeed adjustment to maintain a target temperature and +fanspeed below 85%, with an overheat check that will speed the fan up to 100%. +- Add an --auto-fan command line option to allow all GPUs to have autofan +enabled from startup. +- Add a gpu autotune option which adjusts GPU speed to maintain a target +temperature within the bounds of the default GPU speed and any overclocking set. +- Avoid a dereference if the longpoll thread doesn't exist. +- Clean up by setting performance profiles and fan settings to startup levels on +exit. +- Add a small amount of hysteresis before lowering clock speed. +- Allow target, overheat and hysteresis temperatures to be set from command +line. +- Combine all stats collating into one function to avoid repeating function +calls on each variable. +- Add gpu statistics to debugging output via the watchdog thread. +- Implement menus to change temperature limits. +- Implement setting the GPU engine clock speed of all devices or each device as +a comma separated value. +- Implement setting the GPU memory clock speed of all devices or each device as +a comma separated value. +- Implement setting the GPU voltage of all devices or each device as a comma +separated value. +- Implement setting the GPU fan speed of all devices or each device as a comma +separated value. +- Add support for monitoring powertune setting. +- Implement changing of powertune value from the GPU change settings menu. +- Get the value of powertune in get_stats. +- Implement setting the GPU powertune value of all devices or each device as a +comma separated value. +- Remove the safety checks in speed setting since confirmation is done first in +the menu, then show the new current values after a short pause. +- Force the speed to high on startup and restore it to whatever the setting was +on exit. +- Add temperature to standard output where possible and use more compact output. +- Move and print at the same time in curses to avoid random trampling display +errors. +- Update the status window only from the watchdog thread, do not rewrite the top +status messages and only refresh once all the status window is complete, +clearing the window each time to avoid corruption. +- Set a safe starting fan speed if we're automanaging the speeds. +- Provide locking around all adl calls to prevent races. +- Lower profile settings cannot be higher than higher profile ones so link any +drops in settings. +- Add new needed text files to distribution. +- Queue requests ignoring the number of staged clones since they get discarded +very easily leading to false positives for pool not providing work fast enough. +- Include libgen.h in opt.c to fix win32 compilation warnings. +- Fix compilation warning on win32. +- Add the directory name from the arguments cgminer was called from as well to +allow it running from a relative pathname. +- Add a --disable-adl option to configure and only enable it if opencl support +exists. +- Retry before returning a failure to get upstream work as a failure to avoid +false positives for pool dead. +- Retry also if the decoding of work fails. +- Use the presence of X-Roll-Ntime in the header as a bool for exists unless N +is found in the response. + + +CGMiner Version 1.6.2 - September 2, 2011 + +- Add --failover-only option to not leak work to backup pools when the primary +pool is lagging. +- Change recommendation to intensity 9 for dedicated miners. +- Fix the bouncing short term value by allowing it to change dynamically when +the latest value is very different from the rolling value, but damp the change +when it gets close. +- Use the curses_lock to protect the curses_active variable and test it under +lock. +- Go back to requesting work 2/3 of the way through the current scantime with +CPU mining as reports of mining threads running out of work have occurred with +only 5 seconds to retrieve work. +- Add start and stop time scheduling for regular time of day running or once off +start/stop options. +- Print summary on quit modes. +- Put some sanity checks on the times that can be input. +- Give a verbose message when no active pools are found and pause before +exiting. +- Add verbose message when a GPU fails to initialise, and disable the correct +GPU. +- Cryptopp asm32 was not correctly updated to the incremental nonce code so the +hash counter was bogus. +- Get rid of poorly executed curl check. +- If curl does not have sockopts, do not try to compile the +json_rpc_call_sockopt_cb function, making it possible to build against older +curl libraries. +- Most people expect /usr/local when an unspecified prefix is used so change to +that. +- Rename localgen occasions to getwork fail occasions since localgen is +unrelated now. + + +CGMiner Version 1.6.1 - August 29, 2011 + +- Copy cgminer path, not cat it. +- Switching between redrawing windows does not fix the crash with old +libncurses, so redraw both windows, but only when the window size hasn't +changed. +- Reinstate minimum 1 extra in queue to make it extremely unlikely to ever have +0 staged work items and any idle time. +- Return -1 if no input is detected from the menu to prevent it being +interpreted as a 0. +- Make pthread, libcurl and libcurses library checks mandatory or fail. +- Add a --disable-opencl configure option to make it possible to override +detection of opencl and build without GPU mining support. +- Confusion over the variable name for number of devices was passing a bogus +value which likely was causing the zero sized binary issue. +- cgminer no longer supports default url user and pass so remove them. +- Don't show value of intensity since it's dynamic by default. +- Add options to explicitly enable CPU mining or disable GPU mining. +- Convert the opt queue into a minimum number of work items to have queued +instead of an extra number to decrease risk of getting idle devices without +increasing risk of higher rejects. +- Statify tv_sort. +- Check for SSE2 before trying to build 32 bit SSE2 assembly version. Prevents +build failure when yasm is installed but -msse2 is not specified. +- Add some defines to configure.ac to enable exporting of values and packaging, +and clean up output. +- Give convenient summary at end of ./configure. +- Display version information and add --version command line option, and make +sure we flush stdout. +- Enable curses after the mining threads are set up so that failure messages +won't be lost in the curses interface. +- Disable curses after inputting a pool if we requested no curses interface. +- Add an option to break out after successfully mining a number of accepted +shares. +- Exit with a failed return code if we did not reach opt_shares. +- The cpu mining work data can get modified before we copy it if we submit it +async, and the sync submission is not truly sync anyway, so just submit it sync. + + +CGMiner Version 1.6.0 - August 26, 2011 + +- Make restarting of GPUs optional for systems that hang on any attempt to +restart them. Fix DEAD status by comparing it to last live time rather than +last attempted restart time since that happens every minute. +- Move staged threads to hashes so we can sort them by time. +- Create a hash list of all the blocks created and search them to detect when a +new block has definitely appeared, using that information to detect stale work +and discard it. +- Update configure.ac for newer autoconf tools. +- Use the new hashes directly for counts instead of the fragile counters +currently in use. +- Update to latest sse2 code from cpuminer-ng. +- Allow LP to reset block detect and block detect lp flags to know who really +came first. +- Get start times just before mining begins to not have very slow rise in +average. +- Add message about needing one server. +- We can queue all the necessary work without hitting frequent stales now with +the time and string stale protection active all the time. This prevents a +pool being falsely labelled as not providing work fast enough. +- Include uthash.h in distro. +- Implement SSE2 32 bit assembly algorithm as well. +- Fail gracefully if unable to open the opencl files. +- Make cgminer look in the install directory for the .cl files making make +install work correctly. +- Allow a custom kernel path to be entered on the command line. +- Bump threshhold for lag up to maximum queued but no staged work. +- Remove fragile source patching for bitalign, vectors et. al and simply pass it +with the compiler options. +- Actually check the value returned for the x-roll-ntime extension to make sure +it isn't saying N. +- Prevent segfault on exit for when accessory threads don't exist. +- Disable curl debugging with opt protocol since it spews to stderr. + + +CGMiner Version 1.5.8 - August 23, 2011 + +- Minimise how much more work can be given in cpu mining threads each interval. +- Make the fail-pause progressively longer each time it fails until the network +recovers. +- Only display the lagging message if we've requested the work earlier. +- Clean up the pool switching to not be dependent on whether the work can roll +or not by setting a lagging flag and then the idle flag. +- Only use one thread to determine if a GPU is sick or well, and make sure to +reset the sick restart attempt time. +- The worksize was unintentionally changed back to 4k by mistake, this caused a +slowdown. + + +CGMiner Version 1.5.7 - August 22, 2011 + +- Fix a crash with --algo auto +- Test at appropriate target difficulty now. +- Add per-device statics log output with --per-device-stats +- Fix breakage that occurs when 1 or 4 vectors are chosen on new phatk. +- Make rolltime report debug level only now since we check it every work +item. +- Add the ability to enable/disable per-device stats on the fly and match +logging on/off. +- Explicitly tell the compiler to retain the program to minimise the chance of +the zero sized binary errors. +- Add one more instruction to avoid one branch point in the common path in the +cl return code. Although this adds more ALUs overall and more branch points, the +common path code has the same number of ALUs and one less jmp, jmps being more +expensive. +- Explicitly link in ws2_32 on the windows build and update README file on how +to compile successfully on windows. +- Release cl resources should the gpu mining thread abort. +- Attempt to restart a GPU once every minute while it's sick. +- Don't kill off the reinit thread if it fails to init a GPU but returns safely. +- Only declare a GPU dead if there's been no sign of activity from the reinit +thread for 10 mins. +- Never automatically disable any pools but just specify them as idle if they're +unresponsive at startup. +- Use any longpoll available, and don't disable it if switching to a server that +doesn't have it. This allows you to mine solo, yet use the longpoll from a pool +even if the pool is the backup server. +- Display which longpoll failed and don't free the ram for lp_url since it +belongs to the pool hdr path. +- Make the tcp setsockopts unique to linux in the hope it allows freebsd et. al +to compile. + + +CGMiner Version 1.5.6 - August 17, 2011 + +- New phatk and poclbm kernels. Updated phatk to be in sync with latest 2.2 +courtesy of phateus. Custom modified to work best with cgminer. +- Updated output buffer code to use a smaller buffer with the kernels. +- Clean up the longpoll management to ensure the right paths go to the right +pool and display whether we're connected to LP or not in the status line. + + +CGMiner Version 1.5.5 - August 16, 2011 + +- Rework entirely the GPU restart code. Strike a balance between code that +re-initialises the GPU entirely so that soft hangs in the code are properly +managed, but if a GPU is completely hung, the thread restart code fails +gracefully, so that it does not take out any other code or devices. This will +allow cgminer to keep restarting GPUs that can be restarted, but continue +mining even if one or more GPUs hangs which would normally require a reboot. +- Add --submit-stale option which submits all shares, regardless of whether they +would normally be considered stale. +- Keep options in alphabetical order. +- Probe for slightly longer for when network conditions are lagging. +- Only display the CPU algo when we're CPU mining. +- As we have keepalives now, blaming network flakiness on timeouts appears to +have been wrong. Set a timeout for longpoll to 1 hour, and most other +network connectivity to 1 minute. +- Simplify output code and remove HW errors from CPU stats. +- Simplify code and tidy output. +- Only show cpu algo in summary if cpu mining. +- Log summary at the end as per any other output. +- Flush output. +- Add a linux-usb-cgminer guide courtesy of Kano. + + +CGMiner Version 1.5.4 - August 14, 2011 + +- Add new option: --monitor Option lets user specify a command that +will get forked by cgminer on startup. cgminer's stderr output subsequently gets +piped directly to this command. +- Allocate work from one function to be able to initialise variables added +later. +- Add missing fflush(stdout) for --ndevs and conclusion summary. +- Preinitialise the devices only once on startup. +- Move the non cl_ variables into the cgpu info struct to allow creating a new +cl state on reinit, preserving known GPU variables. +- Create a new context from scratch in initCQ in case something was corrupted to +maximise our chance of succesfully creating a new worker thread. Hopefully this +makes thread restart on GPU failure more reliable, without hanging everything +in the case of a completely wedged GPU. +- Display last initialised time in gpu management info, to know if a GPU has +been re-initialised. +- When pinging a sick cpu, flush finish and then ping it in a separate thread in +the hope it recovers without needing a restart, but without blocking code +elsewhere. +- Only consider a pool lagging if we actually need the work and we have none +staged despite queue requests stacking up. This decreases significantly the +amount of work that leaks to the backup pools. +- The can_roll function fails inappropriately in stale_work. +- Only put the message that a pool is down if not pinging it every minute. This +prevents cgminer from saying pool down at 1 minute intervals unless in debug +mode. +- Free all work in one place allowing us to perform actions on it in the future. +- Remove the extra shift in the output code which was of dubious benefit. In +fact in cgminer's implementation, removing this caused a miniscule speedup. +- Test each work item to see if it can be rolled instead of per-pool and roll +whenever possible, adhering to the 60 second timeout. This makes the period +after a longpoll have smaller dips in throughput, as well as requiring less +getworks overall thus increasing efficiency. +- Stick to rolling only work from the current pool unless we're in load balance +mode or lagging to avoid aggressive rolling imitating load balancing. +- If a work item has had any mining done on it, don't consider it discarded +work. + + +CGMiner Version 1.5.3 - July 30, 2011 + +- Significant work went into attempting to make the thread restart code robust +to identify sick threads, tag them SICK after 1 minute, then DEAD after 5 +minutes of inactivity and try to restart them. Instead of re-initialising the +GPU completely, only a new cl context is created to avoid hanging the rest of +the GPUs should the dead GPU be hung irrevocably. +- Use correct application name in syslog. +- Get rid of extra line feeds. +- Use pkg-config to check for libcurl version +- Implement per-thread getwork count with proper accounting to not over-account +queued items when local work replaces it. +- Create a command queue from the program created from source which allows us +to flush the command queue in the hope it will not generate a zero sized binary +any more. +- Be more willing to get work from the backup pools if the work is simply being +queued faster than it is being retrieved. + + +CGMiner Version 1.5.2 - July 28, 2011 + +- Restarting a hung GPU can hang the rest of the GPUs so just declare it dead +and provide the information in the status. +- The work length in the miner thread gets smaller but doesn't get bigger if +it's under 1 second. This could end up leading to CPU under-utilisation and +lower and lower hash rates. Fix it by increasing work length if it drops +under 1 second. +- Make the "quiet" mode still update the status and display errors, and add a +new --real-quiet option which disables all output and can be set once while +running. +- Update utility and efficiency figures when displaying them. +- Some Intel HD graphics support the opencl commands but return errors since +they don't support opencl. Don't fail with them, just provide a warning and +disable GPU mining. +- Add http:// if it's not explicitly set for URL entries. +- Log to the output file at any time with warnings and errors, instead of just +when verbose mode is on. +- Display the correct current hash as per blockexplorer, truncated to 16 +characters, with just the time. + + +CGMiner Version 1.5.1 - July 27, 2011 + +- Two redraws in a row cause a crash in old libncurses so just do one redraw +using the main window. +- Don't adjust hash_div only up for GPUs. Disable hash_div adjustment for GPUs. +- Only free the thread structures if the thread still exists. +- Update both windows separately, but not at the same time to prevent the double +refresh crash that old libncurses has. Do the window resize check only when +about to redraw the log window to minimise ncurses cpu usage. +- Abstract out the decay time function and use it to make hash_div a rolling +average so it doesn't change too abruptly and divide work in chunks large enough +to guarantee they won't overlap. +- Sanity check to prove locking. +- Don't take more than one lock at a time. +- Make threads report out when they're queueing a request and report if they've +failed. +- Make cpu mining work submission asynchronous as well. +- Properly detect stale work based on time from staging and discard instead of +handing on, but be more lax about how long work can be divided for up to the +scantime. +- Do away with queueing work separately at the start and let each thread grab +its own work as soon as it's ready. +- Don't put an extra work item in the queue as each new device thread will do so +itself. +- Make sure to decrease queued count if we discard the work. +- Attribute split work as local work generation. +- If work has been cloned it is already at the head of the list and when being +reinserted into the queue it should be placed back at the head of the list. +- Dividing work is like the work is never removed at all so treat it as such. +However the queued bool needs to be reset to ensure we *can* request more work +even if we didn't initially. +- Make the display options clearer. +- Add debugging output to tq_push calls. +- Add debugging output to all tq_pop calls. + + +CGMiner Version 1.5.0 - July 26, 2011 + +- Increase efficiency of slow mining threads such as CPU miners dramatically. Do +this by detecting which threads cannot complete searching a work item within the +scantime and then divide up a work item into multiple smaller work items. +Detect the age of the work items and if they've been cloned before to prevent +doing the same work over. If the work is too old to be divided, then see if it +can be time rolled and do that to generate work. This dramatically decreases the +number of queued work items from a pool leading to higher overall efficiency +(but the same hashrate and share submission rate). +- Don't request work too early for CPUs as CPUs will scan for the full +opt_scantime anyway. +- Simplify gpu management enable/disable/restart code. +- Implement much more accurate rolling statistics per thread and per gpu and +improve accuracy of rolling displayed values. +- Make the rolling log-second average more accurate. +- Add a menu to manage GPUs on the fly allowing you to enable/disable GPUs or +try restarting them. +- Keep track of which GPUs are alive versus enabled. +- Start threads for devices that are even disabled, but don't allow them to +start working. +- The last pool is when we are low in total_pools, not active_pools. +- Make the thread restart do a pthread_join after disabling the device, only +re-enabling it if we succeed in restarting the thread. Do this from a separate +thread so as to not block any other code.This will allow cgminer to continue +even if one GPU hangs. +- Try to do every curses manipulation under the curses lock. +- Only use the sockoptfunction if the version of curl is recent enough. + + +CGMiner Version 1.4.1 - July 24, 2011 + +- Do away with GET for dealing with longpoll forever. POST is the one that works +everywhere, not the other way around. +- Detect when the primary pool is lagging and start queueing requests on backup +pools if possible before needing to roll work. +- Load balancing puts more into the current pool if there are disabled pools. +Fix. +- Disable a GPU device should the thread fail to init. +- Out of order command queue may fail on osx. Try without if it fails. +- Fix possible dereference on blank inputs during input_pool. +- Defines missing would segfault on --help when no sse mining is built in. +- Revert "Free up resources/stale compilers." - didn't help. +- Only try to print the status of active devices or it would crash. +- Some hardware might benefit from the less OPS so there's no harm in leaving +kernel changes that do that apart from readability of the code. + +CGMiner Version 1.4.0 - July 23, 2011 + +- Feature upgrade: Add keyboard input during runtime to allow modification of +and viewing of numerous settings such as adding/removing pools, changing +multipool management strategy, switching pools, changing intensiy, verbosity, +etc. with a simple keypress menu system. +- Free up resources/stale compilers. +- Kernels are safely flushed in a way that allows out of order execution to +work. +- Sometimes the cl compiler generates zero sized binaries and only a reboot +seems to fix it. +- Don't try to stop/cancel threads that don't exist. +- Only set option to show devices and exit if built with opencl support. +- Enable curses earlier and exit with message in main for messages to not be +lost in curses windows. +- Make it possible to enter server credentials with curses input if none are +specified on the command line. +- Abstract out a curses input function and separate input pool function to allow +for live adding of pools later. +- Remove the nil arguments check to allow starting without parameters. +- Disable/enable echo & cbreak modes. +- Add a thread that takes keyboard input and allow for quit, silent, debug, +verbose, normal, rpc protocol debugging and clear screen options. +- Add pool option to input and display current pool status, pending code to +allow live changes. +- Add a bool for explicit enabling/disabling of pools. +- Make input pool capable of bringing up pools while running. +- Do one last check of the work before submitting it. +- Implement the ability to live add, enable, disable, and switch to pools. +- Only internally test for block changes when the work matches the current pool +to prevent interleaved block change timing on multipools. +- Display current pool management strategy to enable changing it on the fly. +- The longpoll blanking of the current_block data may not be happening before +the work is converted and appears to be a detected block change. Blank the +current block be +- Make --no-longpoll work again. +- Abstract out active pools count. +- Allow the pool strategy to be modified on the fly. +- Display pool information on the fly as well. +- Add a menu and separate out display options. +- Clean up the messy way the staging thread communicates with the longpoll +thread to determine who found the block first. +- Make the input windows update immediately instead of needing a refresh. +- Allow log interval to be set in the menu. +- Allow scan settings to be modified at runtime. +- Abstract out the longpoll start and explicitly restart it on pool change. +- Make it possible to enable/disable longpoll. +- Set priority correctly on multipools. Display priority and alive/dead +information in display_pools. +- Implement pool removal. +- Limit rolltime work generation to 10 iterations only. +- Decrease testing log to info level. +- Extra refresh not required. +- With huge variation in GPU performance, allow intensity to go from -10 to +10. +- Tell getwork how much of a work item we're likely to complete for future +splitting up of work. +- Remove the mandatory work requirement at startup by testing for invalid work +being passed which allows for work to be queued immediately. This also +removes the requirem +- Make sure intensity is carried over to thread count and is at least the +minimum necessary to work. +- Unlocking error on retry. Locking unnecessary anyway so remove it. +- Clear log window from consistent place. No need for locking since logging is +disabled during input. +- Cannot print the status of threads that don't exist so just queue enough work +for the number of mining threads to prevent crash with -Q N. +- Update phatk kernel to one with new parameters for slightly less overhead +again. Make the queue kernel parameters call a function pointer to select +phatk or poclbm. +- Make it possible to select the choice of kernel on the command line. +- Simplify the output part of the kernel. There's no demonstrable advantage from +more complexity. +- Merge pull request #18 from ycros/cgminer +- No need to make leaveok changes win32 only. +- Build support in for all SSE if possible and only set the default according to +machine capabilities. +- Win32 threading and longpoll keepalive fixes. +- Win32: Fix for mangled output on the terminal on exit. + + +CGMiner Version 1.3.1 - July 20, 2011 + +- Feature upgrade; Multiple strategies for failover. Choose from default which +now falls back to a priority order from 1st to last, round robin which only +changes pools when one is idle, rotate which changes pools at user-defined +intervals, and load-balance which spreads the work evenly amongst all pools. +- Implement pool rotation strategy. +- Implement load balancing algorithm by rotating requests to each pool. +- Timeout on failed discarding of staged requests. +- Implement proper flagging of idle pools, test them with the watchdog thread, +and failover correctly. +- Move pool active test to own function. +- Allow multiple strategies to be set for multipool management. +- Track pool number. +- Don't waste the work items queued on testing the pools at startup. +- Reinstate the mining thread watchdog restart. +- Add a getpoll bool into the thread information and don't restart threads stuck +waiting on work. +- Rename the idlenet bool for the pool for later use. +- Allow the user/pass userpass urls to be input in any order. +- When json rpc errors occur they occur in spits and starts, so trying to limit +them with the comms error bool doesn't stop a flood of them appearing. +- Reset the queued count to allow more work to be queued for the new pool on +pool switch. + +CGMiner Version 1.3.0 - July 19, 2011 + +- Massive infrastructure update to support pool failover. +- Accept multiple parameters for url, user and pass and set up structures of +pool data accordingly. +- Probe each pool for what it supports. +- Implement per pool feature support according to rolltime support as +advertised by server. +- Do switching automatically based on a 300 second timeout of locally generated +work or 60 seconds of no response from a server that doesn't support rolltime. +- Implement longpoll server switching. +- Keep per-pool data and display accordingly. +- Make sure cgminer knows how long the pool has actually been out for before +deeming it a prolonged outage. +- Fix bug with ever increasing staged work in 1.2.8 that eventually caused +infinite rejects. +- Make warning about empty http requests not show by default since many +servers do this regularly. + + +CGMiner Version 1.2.8 - July 18, 2011 + +- More OSX build fixes. +- Add an sse4 algorithm to CPU mining. +- Fix CPU mining with other algorithms not working. +- Rename the poclbm file to ensure a new binary is built since. +- We now are guaranteed to have one fresh work item after a block change and we +should only discard staged requests. +- Don't waste the work we retrieve from a longpoll. +- Provide a control lock around global bools to avoid racing on them. +- Iterating over 1026 nonces when confirming data from the GPU is old code +and unnecessary and can lead to repeats/stales. +- The poclbm kernel needs to be updated to work with the change to 4k sized +output buffers. +- longpoll seems to work either way with post or get but some servers prefer +get so change to httpget. + + +CGMiner Version 1.2.7 - July 16, 2011 + +- Show last 8 characters of share submitted in log. +- Display URL connected to and user logged in as in status. +- Display current block and when it was started in the status line. +- Only pthread_join the mining threads if they exist as determined by +pthread_cancel and don't fail on pthread_cancel. +- Create a unique work queue for all getworks instead of binding it to thread 0 +to avoid any conflict over thread 0's queue. +- Clean up the code to make it clear it's watchdog thread being messaged to +restart the threads. +- Check the current block description hasn't been blanked pending the real +new current block data. +- Re-enable signal handlers once the signal has been received to make it +possible to kill cgminer if it fails to shut down. +- Disable restarting of CPU mining threads pending further investigation. +- Update longpoll messages. +- Add new block data to status line. +- Fix opencl tests for osx. +- Only do local generation of work if the work item is not stale itself. +- Check for stale work within the mining threads and grab new work if +positive. +- Test for idle network conditions and prevent threads from being restarted +by the watchdog thread under those circumstances. +- Make sure that local work generation does not continue indefinitely by +stopping it after 10 minutes. +- Tweak the kernel to have a shorter path using a 4k buffer and a mask on the +nonce value instead of a compare and loop for a shorter code path. +- Allow queue of zero and make that default again now that we can track how +work is being queued versus staged. This can decrease reject rates. +- Queue precisely the number of mining threads as longpoll_staged after a +new block to not generate local work. + + +CGMiner Version 1.2.6 - July 15, 2011 + +- Put a current system status line beneath the total work status line +- Fix a counting error that would prevent cgminer from correctly detecting +situations where getwork was failing - this would cause stalls sometimes +unrecoverably. +- Limit the maximum number of requests that can be put into the queue which +otherwise could get arbitrarily long during a network outage. +- Only count getworks that are real queue requests. + + +CGMiner Version 1.2.5 - July 15, 2011 + +- Conflicting -n options corrected +- Setting an intensity with -I disables dynamic intensity setting +- Removed option to manually disable dynamic intensity +- Improve display output +- Implement signal handler and attempt to clean up properly on exit +- Only restart threads that are not stuck waiting on mandatory getworks +- Compatibility changes courtesy of Ycros to build on mingw32 and osx +- Explicitly grab first work item to prevent false positive hardware errors +due to working on uninitialised work structs +- Add option for non curses --text-only output +- Ensure we connect at least once successfully before continuing to retry to +connect in case url/login parameters were wrong +- Print an executive summary when cgminer is terminated +- Make sure to refresh the status window + +CGMiner Versions -> 1.2.4 + +- Con Kolivas - July 2011. New maintainership of code under cgminer name. +- Massive rewrite to incorporate GPU mining. +- Incorporate original oclminer c code. +- Rewrite gpu mining code to efficient work loops. +- Implement per-card detection and settings. +- Implement vector code. +- Implement bfi int patching. +- Import poclbm and phatk ocl kernels and use according to hardware type. +- Implement customised optimised versions of opencl kernels. +- Implement binary kernel generation and loading. +- Implement preemptive asynchronous threaded work gathering and pushing. +- Implement variable length extra work queues. +- Optimise workloads to be efficient miners instead of getting lots of extra + work. +- Implement total hash throughput counters, per-card accepted, rejected and + hw error count. +- Staging and watchdog threads to prevent fallover. +- Stale and reject share guarding. +- Autodetection of new blocks without longpoll. +- Dynamic setting of intensity to maintain desktop interactivity. +- Curses interface with generous statistics and information. +- Local generation of work (xroll ntime) when detecting poor network +connectivity. + +cpuminer Version 1.0.2 + +- Linux x86_64 optimisations - Con Kolivas +- Optimise for x86_64 by default by using sse2_64 algo +- Detects CPUs and sets number of threads accordingly +- Uses CPU affinity for each thread where appropriate +- Sets scheduling policy to lowest possible +- Minor performance tweaks + +cpuminer Version 1.0.1 - May 14, 2011 + +- OSX support + +cpuminer Version 1.0 - May 9, 2011 + +- jansson 2.0 compatibility +- correct off-by-one in date (month) display output +- fix platform detection +- improve yasm configure bits +- support full URL, in X-Long-Polling header + +cpuminer Version 0.8.1 - March 22, 2011 + +- Make --user, --pass actually work + +- Add User-Agent HTTP header to requests, so that server operators may + more easily identify the miner client. + +- Fix minor bug in example JSON config file + +cpuminer Version 0.8 - March 21, 2011 + +- Support long polling: http://deepbit.net/longpolling.php + +- Adjust max workload based on scantime (default 5 seconds, + or 60 seconds for longpoll) + +- Standardize program output, and support syslog on Unix platforms + +- Suport --user/--pass options (and "user" and "pass" in config file), + as an alternative to the current --userpass + +cpuminer Version 0.7.2 - March 14, 2011 + +- Add port of ufasoft's sse2 assembly implementation (Linux only) + This is a substantial speed improvement on Intel CPUs. + +- Move all JSON-RPC I/O to separate thread. This reduces the + number of HTTP connections from one-per-thread to one, reducing resource + usage on upstream bitcoind / pool server. + +cpuminer Version 0.7.1 - March 2, 2011 + +- Add support for JSON-format configuration file. See example + file example-cfg.json. Any long argument on the command line + may be stored in the config file. +- Timestamp each solution found +- Improve sha256_4way performance. NOTE: This optimization makes + the 'hash' debug-print output for sha256_way incorrect. +- Use __builtin_expect() intrinsic as compiler micro-optimization +- Build on Intel compiler +- HTTP library now follows HTTP redirects + +cpuminer Version 0.7 - February 12, 2011 + +- Re-use CURL object, thereby reuseing DNS cache and HTTP connections +- Use bswap_32, if compiler intrinsic is not available +- Disable full target validation (as opposed to simply H==0) for now + +cpuminer Version 0.6.1 - February 4, 2011 + +- Fully validate "hash < target", rather than simply stopping our scan + if the high 32 bits are 00000000. +- Add --retry-pause, to set length of pause time between failure retries +- Display proof-of-work hash and target, if -D (debug mode) enabled +- Fix max-nonce auto-adjustment to actually work. This means if your + scan takes longer than 5 seconds (--scantime), the miner will slowly + reduce the number of hashes you work on, before fetching a new work unit. + +cpuminer Version 0.6 - January 29, 2011 + +- Fetch new work unit, if scanhash takes longer than 5 seconds (--scantime) +- BeeCee1's sha256 4way optimizations +- lfm's byte swap optimization (improves via, cryptopp) +- Fix non-working short options -q, -r + +cpuminer Version 0.5 - December 28, 2010 + +- Exit program, when all threads have exited +- Improve JSON-RPC failure diagnostics and resilience +- Add --quiet option, to disable hashmeter output. + +cpuminer Version 0.3.3 - December 27, 2010 + +- Critical fix for sha256_cryptopp 'cryptopp_asm' algo + +cpuminer Version 0.3.2 - December 23, 2010 + +- Critical fix for sha256_via + +cpuminer Version 0.3.1 - December 19, 2010 + +- Critical fix for sha256_via +- Retry JSON-RPC failures (see --retry, under "minerd --help" output) + +cpuminer Version 0.3 - December 18, 2010 + +- Add crypto++ 32bit assembly implementation +- show version upon 'minerd --help' +- work around gcc 4.5.x bug that killed 4way performance + +cpuminer Version 0.2.2 - December 6, 2010 + +- VIA padlock implementation works now +- Minor build and runtime fixes + +cpuminer Version 0.2.1 - November 29, 2010 + +- avoid buffer overflow when submitting solutions +- add Crypto++ sha256 implementation (C only, ASM elided for now) +- minor internal optimizations and cleanups + +cpuminer Version 0.2 - November 27, 2010 + +- Add script for building a Windows installer +- improve hash performance (hashmeter) statistics +- add tcatm 4way sha256 implementation +- Add experimental VIA Padlock sha256 implementation + +cpuminer Version 0.1.2 - November 26, 2010 + +- many small cleanups and micro-optimizations +- build win32 exe using mingw +- RPC URL, username/password become command line arguments +- remove unused OpenSSL dependency + +cpuminer Version 0.1.1 - November 24, 2010 + +- Do not build sha256_generic module separately from cpuminer. + +cpuminer Version 0.1 - November 24, 2010 + +- Initial release. + diff --git a/bfgminer3.9/share/doc/bfgminer/README b/bfgminer3.9/share/doc/bfgminer/README new file mode 100644 index 0000000..6d50262 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/README @@ -0,0 +1,854 @@ +BFGMiner: +St. Barbara's Faithfully Glorified Mining Initiative Naturally Exceeding Rivals +or Basically a Freaking Good Miner + +This is a multi-threaded multi-pool ASIC, FPGA, GPU and CPU miner with dynamic +clocking, monitoring, and fanspeed support for bitcoin. Do not use on multiple +block chains at the same time! + +This code is provided entirely free of charge by the programmer in his spare +time so donations would be greatly appreciated. Please consider donating to the +address below. + +Luke-Jr +1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh + +DOWNLOADS: + +http://luke.dashjr.org/programs/bitcoin/files/bfgminer + +GIT TREE: + +https://github.com/luke-jr/bfgminer + +Bug reports: + +https://github.com/luke-jr/bfgminer/issues + +IRC Channel: + +irc://irc.freenode.net/eligius + +License: GPLv3. See COPYING for details. + +SEE ALSO README.ASIC, README.FPGA, README.GPU, README.RPC, AND README.scrypt FOR +MORE INFORMATION ON EACH. + +--- + +EXECUTIVE SUMMARY ON USAGE: + +Single pool: + +bfgminer -o http://pool:port -u username -p password + +Multiple pools: + +bfgminer -o http://pool1:port -u pool1username -p pool1password -o http://pool2:port -u pool2usernmae -p pool2password + +Single pool with a standard http proxy: + +bfgminer -o http://pool:port -x http://proxy:port -u username -p password + +Single pool with a socks5 proxy: + +bfgminer -o http://pool:port -x socks5://proxy:port -u username -p password + +The list of proxy types are: + http: standard http 1.1 proxy + socks4: socks4 proxy + socks5: socks5 proxy + socks4a: socks4a proxy + socks5h: socks5 proxy using a hostname + +Proxy support requires cURL version 7.21.7 or newer. + +If you specify the --socks-proxy option to BFGMiner, it will only be applied to +all pools that don't specify their own proxy setting like above + + +After saving configuration from the menu ([S],[W]) you do not need to give +BFGMiner any arguments, it will load your configuration instead. + +Any configuration file may also contain a single + "include" : "filename" +to recursively include another configuration file. +Writing the configuration will save all settings from all files to the output +configuration file. + + +--- +BUILDING BFGMINER + +Everything you probably want, condensed: + build-essential autoconf automake libtool pkg-config libcurl4-gnutls-dev + libjansson-dev uthash-dev libncursesw5-dev libudev-dev libusb-1.0-0-dev + libevent-dev libmicrohttpd-dev hidapi + +Dependencies: + autoconf http://www.gnu.org/software/autoconf/ + automake http://www.gnu.org/software/automake/ + libtool http://www.gnu.org/software/libtool/ + pkg-config http://www.freedesktop.org/wiki/Software/pkg-config + ...or pkgconf https://github.com/pkgconf/pkgconf + + libcurl4-gnutls-dev http://curl.haxx.se/libcurl/ + + libjansson-dev 2.0+ http://www.digip.org/jansson/ + + uthash-dev 1.9.4+ http://troydhanson.github.io/uthash/ + +Optional Dependencies: + Text-User-Interface (TUI): curses dev library; any one of: + libncurses5-dev http://www.gnu.org/software/ncurses/ (Linux and Mac) + libncursesw5-dev ^ same + libpdcurses http://pdcurses.sourceforge.net/ (Linux/Mac/Windows) + + Multiple ASIC/FPGA autodetection: any one of: + sysfs (built-in to most Linux kernels, just mount on /sys) + libudev-dev http://www.freedesktop.org/software/systemd/libudev/ + + HashBuster Nano & NanoFury USB devices: + hidapi https://github.com/signal11/hidapi + + getwork server for Block Erupter Blades: + libmicrohttpd-dev 0.9.5+ http://www.gnu.org/software/libmicrohttpd/ + + Stratum proxy: + libevent 2.0.3+ http://libevent.org/ + + HashBuster Micro, Klondike, X6500 and ZTEX FPGA boards: + libusb-1.0-0-dev http://www.libusb.org/ + + Video card GPU mining (free): + llvm 3.3+ http://llvm.org/ + clang 3.3+ http://clang.llvm.org/ + libclc http://libclc.llvm.org/ + Mesa 9.2.0+ http://www.mesa3d.org/ + + ATi/AMD video card GPU mining (non-free): + AMD APP SDK http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/ + + CPU mining optimized assembly algorithms: + yasm 1.0.1+ http://yasm.tortall.net/ + + +BFGMiner specific configuration options: + --disable-avalon Compile support for Avalon (default enabled) + --enable-cpumining Build with cpu mining support(default disabled) + --enable-opencl Compile support for OpenCL (default disabled) + --disable-adl Build without ADL monitoring (default enabled) + --disable-bitfury Compile support for Bitfury (default enabled) + --enable-bfsb Compile support for BFSB (default disabled) + --disable-bigpic Compile support for Big Picture Mining USB (default + enabled) + --disable-littlefury Compile support for LittleFury (default enabled) + --disable-nanofury Compile support for NanoFury (default enabled) + --disable-hashbuster Compile support for HashBuster Nano (default + enabled) + --disable-hashbuster2 Compile support for HashBuster Micro (default if + libusb) + --enable-metabank Compile support for Metabank (default disabled) + --disable-bitforce Compile support for BitForce (default enabled) + --disable-icarus Compile support for Icarus (default enabled) + --disable-klondike Compile support for Klondike (default enabled) + --enable-knc Compile support for KnC (default disabled) + --disable-modminer Compile support for ModMiner (default enabled) + --disable-x6500 Compile support for X6500 (default enabled) + --disable-ztex Compile support for ZTEX (default if libusb) + --enable-scrypt Compile support for scrypt mining (default disabled) + --with-system-libblkmaker Use system libblkmaker rather than bundled one + (default disabled) + --with-udevrulesdir=DIR Install udev rules into this directory + --without-sensors Build with libsensors monitoring (default enabled) + --without-curses Compile support for curses TUI (default enabled) + --without-libmicrohttpd Compile support for libmicrohttpd getwork server + (default enabled) + --without-libevent Compile support for libevent stratum server (default + enabled) + --without-libusb Compile using libusb (default enabled) + --without-libudev Autodetect FPGAs using libudev (default enabled) + +Basic *nix build instructions: + +./autogen.sh # only needed if building from git repo +./configure +make + +No installation is necessary. You may run BFGMiner from the build directory +directly. + +On Mac OS X, you can use Homebrew to install the dependency libraries. When you +are ready to build BFGMiner, you may need to point the configure script at one +or more pkg-config paths. For example: + ./configure PKG_CONFIG_PATH=/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/jansson/lib/pkgconfig + +Native WIN32 build instructions: see windows-build.txt + +If you build BFGMiner from source, it is recommended that you run it from the +build directory. On *nix, you will usually need to prepend your command with a +path like this (if you are in the bfgminer directory already): ./bfgminer +To install system wide run 'sudo make install' or 'make install' as root. You +can then run from any terminal. + +--- + +Usage instructions: Run "bfgminer --help" to see options: + +Usage: bfgminer [-DdElmpPQqUsTouOchnV] + +Options for both config file and command line: +--api-allow Allow API access (if enabled) only to the given list of [W:]IP[/Prefix] address[/subnets] + This overrides --api-network and you must specify 127.0.0.1 if it is required + W: in front of the IP address gives that address privileged access to all api commands +--api-description Description placed in the API status header (default: BFGMiner version) +--api-groups API one letter groups G:cmd:cmd[,P:cmd:*...] + See README.RPC for usage +--api-listen Listen for API requests (default: disabled) + By default any command that does not just display data returns access denied + See --api-allow to overcome this +--api-mcast Enable API Multicast listener, default: disabled +--api-mcast-addr API Multicast listen address (default: "224.0.0.75") +--api-mcast-code Code expected in the API Multicast message, don't use '-' (default: "FTW") +--api-mcast-port API Multicast listen port (default: 4028) +--api-network Allow API (if enabled) to listen on/for any address (default: only 127.0.0.1) +--api-port Port number of miner API (default: 4028) +--balance Change multipool strategy from failover to even share balance +--benchmark Run BFGMiner in benchmark mode - produces no shares +--chroot-dir Chroot to a directory right after startup +--cmd-idle Execute a command when a device is allowed to be idle (rest or wait) +--cmd-sick Execute a command when a device is declared sick +--cmd-dead Execute a command when a device is declared dead +--coinbase-addr Set coinbase payout address for solo mining +--coinbase-sig Set coinbase signature when possible +--compact Use compact display without per device statistics +--debug|-D Enable debug output +--debuglog Enable debug logging +--device|-d Enable only devices matching pattern (default: all) +--disable-rejecting Automatically disable pools that continually reject shares +--http-port Port number to listen on for HTTP getwork miners (-1 means disabled) (default: -1) +--expiry|-E Upper bound on how many seconds after getting work we consider a share from it stale (w/o longpoll active) (default: 120) +--expiry-lp Upper bound on how many seconds after getting work we consider a share from it stale (with longpoll active) (default: 3600) +--failover-only Don't leak work to backup pools when primary pool is lagging +--force-dev-init Always initialize devices when possible (such as bitstream uploads to some FPGAs) +--kernel-path|-K Specify a path to where bitstream and kernel files are (default: "/usr/local/bin") +--load-balance Change multipool strategy from failover to quota based balance +--log|-l Interval in seconds between log output (default: 5) +--log-file|-L Append log file for output messages +--log-microseconds Include microseconds in log output +--monitor|-m Use custom pipe cmd for output messages +--net-delay Impose small delays in networking to avoid overloading slow routers +--no-gbt Disable getblocktemplate support +--no-getwork Disable getwork support +--no-longpoll Disable X-Long-Polling support +--no-restart Do not attempt to restart devices that hang +--no-stratum Disable Stratum detection +--no-submit-stale Don't submit shares if they are detected as stale +--no-opencl-binaries Don't attempt to use or save OpenCL kernel binaries +--no-unicode Don't use Unicode characters in TUI +--noncelog Create log of all nonces found +--pass|-p Password for bitcoin JSON-RPC server +--per-device-stats Force verbose mode and output per-device statistics +--pool-proxy|-x Proxy URI to use for connecting to just the previous-defined pool +--protocol-dump|-P Verbose dump of protocol-level activities +--queue|-Q Minimum number of work items to have queued (0 - 10) (default: 1) +--quiet|-q Disable logging output, display status and errors +--real-quiet Disable all output +--remove-disabled Remove disabled devices entirely, as if they didn't exist +--request-diff Request a specific difficulty from pools (default: 1.0) +--retries Number of times to retry failed submissions before giving up (-1 means never) (default: -1) +--rotate Change multipool strategy from failover to regularly rotate at N minutes (default: 0) +--round-robin Change multipool strategy from failover to round robin on failure +--scan|-S Configure how to scan for mining devices +--scan-time|-s Upper bound on time spent scanning current work, in seconds (default: 60) +--sched-start Set a time of day in HH:MM to start mining (a once off without a stop time) +--sched-stop Set a time of day in HH:MM to stop mining (will quit without a start time) +--scrypt Use the scrypt algorithm for mining (non-bitcoin) +--set-device Set default parameters on devices; eg, NFY:osc6_bits=50 +--setuid Username of an unprivileged user to run as +--sharelog Append share log to file +--shares Quit after mining N shares (default: unlimited) +--show-processors Show per processor statistics in summary +--skip-security-checks Skip security checks sometimes to save bandwidth; only check 1/th of the time (default: never skip) +--socks-proxy Set socks proxy (host:port) for all pools without a proxy specified +--stratum-port Port number to listen on for stratum miners (-1 means disabled) (default: -1) +--submit-threads Minimum number of concurrent share submissions (default: 64) +--syslog Use system log for output messages (default: standard error) +--temp-cutoff Maximum temperature devices will be allowed to reach before being disabled, one value or comma separated list +--temp-hysteresis Set how much the temperature can fluctuate outside limits when automanaging speeds (default: 3) +--temp-target Target temperature when automatically managing fan and clock speeds +--text-only|-T Disable ncurses formatted screen output +--unicode Use Unicode characters in TUI +--url|-o URL for bitcoin JSON-RPC server +--user|-u Username for bitcoin JSON-RPC server +--verbose Log verbose output to stderr as well as status output +--weighed-stats Display statistics weighed to difficulty 1 +--userpass|-O Username:Password pair for bitcoin JSON-RPC server +Options for command line only: +--config|-c Load a JSON-format configuration file +See example.conf for an example configuration. +--help|-h Print this message +--version|-V Display version and exit + + +GPU only options: + +--auto-fan Automatically adjust all GPU fan speeds to maintain a target temperature +--auto-gpu Automatically adjust all GPU engine clock speeds to maintain a target temperature +--gpu-threads|-g Number of threads per GPU (1 - 10) (default: 2) +--gpu-dyninterval Set the refresh interval in ms for GPUs using dynamic intensity (default: 7) +--gpu-engine GPU engine (over)clock range in MHz - one value, range and/or comma separated list (e.g. 850-900,900,750-850) +--gpu-fan GPU fan percentage range - one value, range and/or comma separated list (e.g. 25-85,85,65) +--gpu-map Map OpenCL to ADL device order manually, paired CSV (e.g. 1:0,2:1 maps OpenCL 1 to ADL 0, 2 to 1) +--gpu-memclock Set the GPU memory (over)clock in MHz - one value for all or separate by commas for per card. +--gpu-memdiff Set a fixed difference in clock speed between the GPU and memory in auto-gpu mode +--gpu-platform Select OpenCL platform ID to use for GPU mining +--gpu-powertune Set the GPU powertune percentage - one value for all or separate by commas for per card. +--gpu-reorder Attempt to reorder GPU devices according to PCI Bus ID +--gpu-vddc Set the GPU voltage in Volts - one value for all or separate by commas for per card. +--intensity|-I Intensity of GPU scanning (d or -10 -> 10, default: d to maintain desktop interactivity) +--kernel|-k Override kernel to use (diablo, poclbm, phatk or diakgcn) - one value or comma separated +--no-adl Disable the ATI display library used for monitoring and setting GPU parameters +--temp-overheat Overheat temperature when automatically managing fan and GPU speeds (default: 85) +--vectors|-v Override detected optimal vector (1, 2 or 4) - one value or comma separated list +--worksize|-w Override detected optimal worksize - one value or comma separated list + +GPU mining is disabled by default for SHA256d if you have any dedicated mining +devices, but can be enabled explicitly specifying the -S opencl:auto option. + +See README.GPU for more information regarding GPU mining. + +scrypt only options: + +--lookup-gap Set GPU lookup gap for scrypt mining, comma separated +--shaders GPU shaders per card for tuning scrypt, comma separated +--thread-concurrency Set GPU thread concurrency for scrypt mining, comma separated + +See README.scrypt for more information regarding (non-bitcoin) scrypt mining. + + +To use ASICs or FPGAs, you will need to be sure the user BFGMiner is running as +has appropriate permissions. This varies by operating system. +On Gentoo: sudo usermod -a -G uucp +On Ubuntu: sudo usermod -a -G dialout +Note that on GNU/Linux systems, you will usually need to login again before +group changes take effect. + +By default, BFGMiner will scan for autodetected devices. If you want to prevent +BFGMiner from doing this, you can use "-S noauto". If you want to probe all +serial ports, you can use "-S all"; note that this may write data to non-mining +devices which may then behave in unexpected ways! + +On Linux, is usually of the format /dev/ttyUSBn +On Mac OS X, is usually of the format /dev/cu.usb* +On Windows, is usually of the format \\.\COMn +(where n = the correct device number for the device) + +The official supplied binaries are compiled with support for all ASICs/FPGAs. +To force the code to only attempt detection with a specific driver, +prepend the argument with the driver name followed by an "at" symbol. +For example, "icarus@/dev/ttyUSB0" or "bitforce@\\.\COM5" +or using the short name: "ica@/dev/ttyUSB0" or "bfl@\\.\COM5" + +Some FPGAs do not have non-volatile storage for their bitstreams and must be +programmed every power cycle, including first use. To use these devices, you +must download the proper bitstream from the vendor's website and copy it to the +"bitstreams" directory into your BFGMiner application directory. + +See README.ASIC and README.FPGA for more information regarding these. + +See README.CPU for information regarding CPU mining. + +--- + +WHILE RUNNING: + +The following options are available while running with a single keypress: + +[M]anage devices [P]ool management [S]ettings [D]isplay options [H]elp [Q]uit + +M gives you something like: + +Select processor to manage using up/down arrow keys + BFL 0a: 78.0C | 3.64/ 3.70/ 2.91Gh/s | A:46 R:0+0(none) HW: 2/none + BitFORCE SHA256 SC from Butterfly Labs +Serial: FTWN6T67 + +[D]isable +Or press Enter when done + + +P gives you: + +Current pool management strategy: Failover +[F]ailover only disabled +[A]dd pool [R]emove pool [D]isable pool [E]nable pool +[C]hange management strategy [S]witch pool [I]nformation + + +S gives you: + +[L]ongpoll: On +[Q]ueue: 1 +[S]cantime: 60 +[E]xpiry: 120 +[R]etries: -1 +[W]rite config file +[B]FGMiner restart + + +D gives you: + +[N]ormal [C]lear [S]ilent mode (disable all output) +[D]ebug:off +[P]er-device:off +[Q]uiet:off +[V]erbose:off +[R]PC debug:off +[W]orkTime details:off +co[M]pact: off +[L]og interval:5 + + +Q quits the application. + + +The running log shows output similar to that below: + + [2013-02-13 00:26:30] Accepted 1758e8df BFL 0 pool 0 Diff 10/1 + [2013-02-13 00:26:32] Accepted 1d9a2199 MMQ 0a pool 0 Diff 8/1 + [2013-02-13 00:26:33] Accepted b1304924 ZTX 0 pool 0 Diff 1/1 + [2013-02-13 00:26:33] Accepted c3ad22f4 XBS 0b pool 0 Diff 1/1 + +The 8 byte hex value are the 2nd set of 32 bits from the share submitted to the +pool. The 2 diff values are the actual difficulty target that share reached +followed by the difficulty target the pool is currently asking for. + +--- +Also many issues and FAQs are covered in the forum threads +dedicated to this program, + https://bitcointalk.org/?topic=78192 + https://bitcointalk.org/?topic=168174 + +The block display shows: +Block: ...1b89f8d3 #217364 Diff:7.67M (54.93Th/s) Started: [17:17:22] + +This shows a short stretch of the current block, the next block's height and +difficulty (including the network hashrate that difficulty represents), and when +the search for the new block started. + +The BFGMiner status line shows: + ST:1 F:0 NB:1 AS:0 BW:[ 75/241 B/s] E:2.42 I:12.99mBTC/hr BS:2.71k + +ST is STaged work items (ready to use). +F is network Failure occasions (server down or slow to provide work) +NB is New Blocks detected on the network +AS is Active Submissions (shares in the process of submitting) +BW is BandWidth usage on the network (received/sent) +E is Efficiency defined as number of shares accepted (multiplied by their + difficulty) per 2 KB of bandwidth +I is expected Income, calculated by actual shares submitted in 100% PPS value + (assumes Bitcoin, does not account for altcoin conversions!) +BS is the all time Best Share difficulty you've found + +The totals line shows the following: + 6/32 75.0C | 171.3/170.8/171.2Gh/s | A:729 R:8+0(.01%) HW:0/.81% + +Each column is as follows: + The number of devices and processors currently mining + Hottest temperature reported by any processor + 5 second exponentially decaying average hash rate + An all time average hash rate + An all time average hash rate based on actual nonces found, adjusted for pool + reject and stale rate + The number of Accepted shares + The number of Rejected shares and stale shares discarded (never submitted), + and the percentage these are of total found. + The number of HardWare errors, and percentage invalid of nonces returned + +Each device shows: + BFL 2: 74.0C | 51.97/58.90/57.17Gh/s | A:847 R:15+0(.54%) HW:496/.91% + +Columns are the same as in the totals line. + + +--- +MULTIPOOL + +FAILOVER STRATEGIES WITH MULTIPOOL: +A number of different strategies for dealing with multipool setups are +available. Each has their advantages and disadvantages so multiple strategies +are available by user choice, as per the following list: + +FAILOVER: +The default strategy is failover. This means that if you input a number of +pools, it will try to use them as a priority list, moving away from the 1st +to the 2nd, 2nd to 3rd and so on. If any of the earlier pools recover, it will +move back to the higher priority ones. + +ROUND ROBIN: +This strategy only moves from one pool to the next when the current one falls +idle and makes no attempt to move otherwise. + +ROTATE: +This strategy moves at user-defined intervals from one active pool to the next, +skipping pools that are idle. + +LOAD BALANCE: +This strategy sends work to all the pools on a quota basis. By default, all +pools are allocated equal quotas unless specified with --quota. This +apportioning of work is based on work handed out, not shares returned so is +independent of difficulty targets or rejected shares. While a pool is disabled +or dead, its quota is dropped until it is re-enabled. Quotas are forward +looking, so if the quota is changed on the fly, it only affects future work. +If all pools are set to zero quota or all pools with quota are dead, it will +fall back to a failover mode. See quota below for more information. + +The failover-only flag has special meaning in combination with load-balance +mode and it will distribute quota back to priority pool 0 from any pools that +are unable to provide work for any reason so as to maintain quota ratios +between the rest of the pools. + +BALANCE: +This strategy monitors the amount of difficulty 1 shares solved for each pool +and uses it as a basis for trying to doing the same amount of work for each +pool. + + +--- +SOLO MINING + +BFGMiner supports solo mining with any GBT-compatible bitcoin node (such as +bitcoind). To use this mode, you need to specify the URL of your bitcoind node +using the usual pool options (--url, --userpass, etc), and the --coinbase-addr +option to specify the Bitcoin address you wish to receive the block rewards +mined. If you are solo mining with more than one instance of BFGMiner (or any +other software) per payout address, you must also specify data using the +--coinbase-sig option to ensure each miner is working on unique work. Note +that this data will be publicly seen if your miner finds a block using any +GBT-enabled pool, even when not solo mining (such as failover). If your +bitcoin node does not support longpolling (for example, bitcoind 0.8.x), you +should consider setting up a failover pool to provide you with block +notifications. Note that solo mining does not use shares, so BFGMiner's adjusted +hashrate (third column) may suddenly drop to zero if a block you submit is +rejected; this does not indicate that it has stopped mining. + +Example solo mining usage: + +bfgminer -o http://localhost:8332 -u username -p password \ + --coinbase-addr 1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh \ + --coinbase-sig "rig1: This is Joe's block!" + + +--- +QUOTAS + +The load-balance multipool strategy works off a quota based scheduler. The +quotas handed out by default are equal, but the user is allowed to specify any +arbitrary ratio of quotas. For example, if all the quota values add up to 100, +each quota value will be a percentage, but if 2 pools are specified and pool0 +is given a quota of 1 and pool1 is given a quota of 9, pool0 will get 10% of +the work and pool1 will get 90%. Quotas can be changed on the fly with RPC, +and do not act retrospectively. Setting a quota to zero will effectively +disable that pool unless all other pools are disabled or dead. In that +scenario, load-balance falls back to regular failover priority-based strategy. +While a pool is dead, it loses its quota and no attempt is made to catch up +when it comes back to life. + +To specify quotas on the command line, pools should be specified with a +semicolon separated --quota(or -U) entry instead of --url. Pools specified with +--url are given a nominal quota value of 1 and entries can be mixed. + +For example: +--url poolA:portA -u usernameA -p passA --quota "2;poolB:portB" -u usernameB -p passB +Will give poolA 1/3 of the work and poolB 2/3 of the work. + +Writing configuration files with quotas is likewise supported. To use the above +quotas in a configuration file they would be specified thus: + +"pools" : [ + { + "url" : "poolA:portA", + "user" : "usernameA", + "pass" : "passA" + }, + { + "quota" : "2;poolB:portB", + "user" : "usernameB", + "pass" : "passB" + } +] + + +--- +LOGGING + +BFGMiner will log to stderr if it detects stderr is being redirected to a file. +To enable logging simply add 2>logfile.txt to your command line and logfile.txt +will contain the logged output at the log level you specify (normal, verbose, +debug etc.) + +In other words if you would normally use: +./bfgminer -o xxx -u yyy -p zzz +if you use +./bfgminer -o xxx -u yyy -p zzz 2>logfile.txt +it will log to a file called logfile.txt and otherwise work the same. + +There is also the -m option on linux which will spawn a command of your choice +and pipe the output directly to that command. + +The WorkTime details 'debug' option adds details on the end of each line +displayed for Accepted or Rejected work done. An example would be: + + <-00000059.ed4834a3 M:X D:1.0 G:17:02:38:0.405 C:1.855 (2.995) W:3.440 (0.000) S:0.461 R:17:02:47 + +The first 2 hex codes are the previous block hash, the rest are reported in +seconds unless stated otherwise: +The previous hash is followed by the getwork mode used M:X where X is one of +P:Pool, T:Test Pool, L:LP or B:Benchmark, +then D:d.ddd is the difficulty required to get a share from the work, +then G:hh:mm:ss:n.nnn, which is when the getwork or LP was sent to the pool and +the n.nnn is how long it took to reply, +followed by 'O' on its own if it is an original getwork, or 'C:n.nnn' if it was +a clone with n.nnn stating how long after the work was recieved that it was +cloned, (m.mmm) is how long from when the original work was received until work +started, +W:n.nnn is how long the work took to process until it was ready to submit, +(m.mmm) is how long from ready to submit to actually doing the submit, this is +usually 0.000 unless there was a problem with submitting the work, +S:n.nnn is how long it took to submit the completed work and await the reply, +R:hh:mm:ss is the actual time the work submit reply was received + +If you start BFGMiner with the --sharelog option, you can get detailed +information for each share found. The argument to the option may be "-" for +standard output (not advisable with the ncurses UI), any valid positive number +for that file descriptor, or a filename. + +To log share data to a file named "share.log", you can use either: +./bfgminer --sharelog 50 -o xxx -u yyy -p zzz 50>share.log +./bfgminer --sharelog share.log -o xxx -u yyy -p zzz + +For every share found, data will be logged in a CSV (Comma Separated Value) +format: + timestamp,disposition,target,pool,dev,thr,sharehash,sharedata +For example (this is wrapped, but it's all on one line for real): + 1335313090,reject, + ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000, + http://localhost:8337,GPU0,0, + 6f983c918f3299b58febf95ec4d0c7094ed634bc13754553ec34fc3800000000, + 00000001a0980aff4ce4a96d53f4b89a2d5f0e765c978640fe24372a000001c5 + 000000004a4366808f81d44f26df3d69d7dc4b3473385930462d9ab707b50498 + f681634a4f1f63d01a0cd43fb338000000000080000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000080020000 + +--- + +RPC API + +For RPC API details see the README.RPC file + +--- + +FAQ + +Q: Why can't BFGMiner find lib even after I installed it from source +code? +A: On UNIX-like operating systems, you often need to run one or more commands to +reload library caches, such as "ldconfig" or similar. A couple of systems (such +as Fedora) ship with /usr/local/lib missing from their library search path. In +this case, you can usually add it like this: + echo /usr/local/lib >/etc/ld.so.conf.d/local.conf +Please note that if your libraries installed into lib64 instead of lib, you +should use that in the ld.so config file above instead. + +Q: BFGMiner segfaults when I change my shell window size. +A: Older versions of libncurses have a bug to do with refreshing a window +after a size change. Upgrading to a new version of curses will fix it. + +Q: Can I mine on servers from different networks (eg smartcoin and bitcoin) at +the same time? +A: No, BFGMiner keeps a database of the block it's working on to ensure it does +not work on stale blocks, and having different blocks from two networks would +make it invalidate the work from each other. + +Q: Can I configure BFGMiner to mine with different login credentials or pools +for each separate device? +A: No such feature has been implemented to support this. + +Q: Can I put multiple pools in the config file? +A: Yes, check the example.conf file. Alternatively, set up everything either on +the command line or via the menu after startup and choose [S]ettings->[W]rite +config file and the file will be loaded one each startup. + +Q: The build fails with gcc is unable to build a binary. +A: Remove the "-march=native" component of your CFLAGS as your version of GCC +does not support it. + +Q: Can you implement feature X? +A: I can, but time is limited, and people who donate are more likely to get +their feature requests implemented. + +Q: Work keeps going to my backup pool even though my primary pool hasn't +failed? +A: BFGMiner checks for conditions where the primary pool is lagging and will +pass some work to the backup servers under those conditions. The reason for +doing this is to try its absolute best to keep the devices working on something +useful and not risk idle periods. You can disable this behaviour with the +option --failover-only. + +Q: Is this a virus? +A: As BFGMiner is being packaged with other trojan scripts, some antivirus +software is falsely accusing bfgminer.exe as being the actual virus, rather than +whatever it is being packaged with. If you installed BFGMiner yourself from a +reputable source then you do not have a virus on your computer. Complain to your +antivirus software company. They seem to be flagging even source code from +BFGMiner as malicious now, even though text source files can't do anything by +themselves. + +Q: Can you modify the display to include more of one thing in the output and +less of another, or can you change the quiet mode or can you add yet another +output mode? +A: Everyone will always have their own view of what is important to monitor. +The defaults are very sane and I have very little interest in changing this +any further. + +Q: Why is my efficiency above/below 1.00? +A: Efficiency simply means how many shares you return for the amount of +bandwidth used. It does not correlate with efficient use of your hardware, and +is a measure of a combination of hardware speed, block luck, pool design and +many other factors. + +Q: What are the best parameters to pass for X pool/hardware/device. +A: Virtually always, the DEFAULT parameters give the best results. Most user +defined settings lead to worse performance. + +Q: What happened to CPU mining? +A: See README.CPU for more information. + +Q: Is there a GUI version? +A: Yes, Nate Woolls maintains a GUI interface for BFGMiner called MultiMiner, +available at http://multiminerapp.com + +Q: I'm having an issue. What debugging information should I provide? +A: Start BFGMiner with your regular commands and add -D -T --verbose and provide +the full startup output and a summary of your hardware, operating system, and if +applicable, ATI driver version and ATI stream version. + +Q: Can I mine with BFGMiner on a Mac? +A: BFGMiner will compile on OS X, but the performance of GPU mining is +compromised due to the OpenCL implementation on OS X, there is no temperature or +fanspeed monitoring and the cooling design of most Macs, despite having +powerful GPUs, will usually not cope with constant usage leading to a high risk +of thermal damage. It is highly recommended not to mine on a Mac unless it is +with an external USB device. + +Q: My network gets slower and slower and then dies for a minute? +A; Try the --net-delay option if you are on a getwork or GBT server. + +Q: How do I tune for P2Pool? +A: P2Pool has very rapid expiration of work and new blocks, it is suggested you +decrease intensity by 1 from your optimal value, and decrease GPU threads to 1 +with -g 1. It is also recommended to use --failover-only since the work is +effectively like a different block chain. If mining with a Mini Rig, it is worth +adding the --bfl-range option. + +Q: Are OpenCL kernels from other mining software useable in BFGMiner? +A: No, the APIs are slightly different between the different software and they +will not work. + +Q: I run PHP on windows to access the API with the example miner.php. Why does +it fail when php is installed properly but I only get errors about Sockets not +working in the logs? +A: Please check http://us.php.net/manual/en/sockets.installation.php + +Q: What is a PGA? +A: At the moment, BFGMiner supports 5 FPGAs: BitForce, Icarus, ModMiner, X6500, +and ZTEX. +They are Field-Programmable Gate Arrays that have been programmed to do Bitcoin +mining. Since the acronym needs to be only 3 characters, the "Field-" part has +been skipped. "PGA" is also used for devices built with Application-Specific +Integrated Circuits (ASICs). + +Q: What is an ASIC? +A: They are Application Specific Integrated Circuit devices and provide the +highest performance per unit power due to being dedicated to only one purpose. + +Q: How do I get my BFL/Icarus/Lancelot/Cairnsmore device to auto-recognise? +A: On Linux, if the /dev/ttyUSB* devices don't automatically appear, the only +thing that needs to be done is to load the driver for them: + BitForce: sudo modprobe ftdi_sio vendor=0x0403 product=0x6014 + Erupter: sudo modprobe cp210x vendor=0x10c4 product=0xea60 + Icarus: sudo modprobe pl2303 vendor=0x067b product=0x0230 + Lancelot: sudo modprobe ftdi_sio vendor=0x0403 product=0x6001 + Cairnsmore: sudo modprobe ftdi_sio vendor=0x0403 product=0x8350 +On some systems you must manally install the driver required for the device. +OpenWrt drivers (install with opkg): + FTDI: kmod-usb-serial-ftdi + Erupter: kmod-usb-serial-cp210x + Icarus: kmod-usb-serial-pl2303 +Windows drivers: + FTDI: http://www.ftdichip.com/Drivers/VCP.htm + Erupter: http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx + Icarus: http://prolificusa.com/pl-2303hx-drivers/ + +Q: I ran cgminer, and now BFGMiner doesn't work! +A: cgminer has its own non-standard implementations of the drivers for most USB +devices, and requires you to replace the official drivers with WinUSB on Windows +(usually using Zadig). Before you can use BFGMiner, you will need to restore the +original driver. Uninstalling the device (and WinUSB driver) from Device Manager +and re-plugging it will usually trigger driver re-installation to the default +drivers. + +Q: On Linux I can see the /dev/ttyUSB* devices for my ICA/BFL/MMQ FPGA, but +BFGMiner can't mine on them? +A: Make sure you have the required privileges to access the /dev/ttyUSB* +devices: + sudo ls -las /dev/ttyUSB* +will give output like: + 0 crw-rw---- 1 root dialout 188, 0 2012-09-11 13:49 /dev/ttyUSB0 +This means your account must have the group 'dialout' or root privileges +To permanently give your account the 'dialout' group: + sudo usermod -G dialout -a `whoami` +Then logout and back in again + +Q: Can I mine scrypt with FPGAs or ASICs? +A: Currently no. Bitcoin ASICs are only useful for SHA256d systems and FPGAs +generally aren't designed to handle scrypt efficiently. + +Q: Why does BFGMiner show difficulty 0 when mining scrypt? +A: BFGMiner consistently uses pdiff measurement for difficulty everywhere, +rather than other measurements that may exist. For scrypt, pdiff 1 is very +difficult, and higher get exponentially harder. It is unlikely you will want to +use pdiff 1+ with scrypt until you have FPGAs and/or ASICs for it. + +Q: What is stratum and how do I use it? +A: Stratum is a protocol designed to reduce resources for mining pools at the +cost of keeping the miner in the dark and blindly transferring his mining +authority to the pool. It is a return to the problems of the old centralized +"getwork" protocol, but capable of scaling to hardware of any speed like the +standard GBT protocol. If a pool uses stratum instead of GBT, BFGMiner will +automatically detect it and switch to the support as advertised if it can. +Stratum uses direct TCP connections to the pool and thus it will NOT currently +work through a http proxy but will work via a socks proxy if you need to use +one. If you input the stratum port directly into your configuration, or use the +special prefix "stratum+tcp://" instead of "http://", BFGMiner will ONLY try to +use stratum protocol mining. + +Q: Why don't the statistics add up: Accepted, Rejected, Stale, Hardware Errors, +Diff1 Work, etc. when mining greater than 1 difficulty shares? +A: As an example, if you look at 'Difficulty Accepted' in the RPC API, the number +of difficulty shares accepted does not usually exactly equal the amount of work +done to find them. If you are mining at 8 difficulty, then you would expect on +average to find one 8 difficulty share, per 8 single difficulty shares found. +However, the number is actually random and converges over time as it is an +average, not an exact value, thus you may find more or less than the expected +average. + +--- + +This code is provided entirely free of charge by the programmer in his spare +time so donations would be greatly appreciated. Please consider donating to the +address below. + +Luke-Jr +1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh diff --git a/bfgminer3.9/share/doc/bfgminer/README.ASIC b/bfgminer3.9/share/doc/bfgminer/README.ASIC new file mode 100644 index 0000000..8aa330c --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/README.ASIC @@ -0,0 +1,205 @@ +SUPPORTED DEVICES + +Currently supported ASIC devices include Avalon, Bitfountain's Block Erupter +series (both USB and blades), a large variety of Bitfury-based miners, +Butterfly Labs' SC range of devices, HashBuster boards, Klondike modules, and +KnCminer's Mercury, Jupiter and Saturn. + + +AVALON +------ + +Currently, Avalon boards are supported only by connecting them directly (or via +a hub) to a regular PC running BFGMiner. It is also possible to install the +OpenWrt packages of BFGMiner to the Avalon's embedded controller, but this is +not a simple task due to its lack of available flash space. + +To use the Avalon from a regular PC, you will need to specify two options: +First, add the -S option specifying the avalon driver specifically. For example, + +-S avalon:\\.\COM9 + +Next, use the --avalon-options copying the command as used by the internal +router used by the Avalon. eg: + +--avalon-options 115200:24:10:45:282 + +The values are baud : miners : asic count : timeout : frequency. + +Baud: +The device is essentially hard coded to emulate 115200 baud so you shouldn't +change this. + +Miners: +Most Avalons are 3 module devices, which come to 24 miners. 4 module devices +would use 32 here. + +Asic count: +Virtually all have 10, so don't change this. + +Timeout: +This defines how long the device will work on a work item before accepting new +work to replace it. It should be changed according to the frequency (last +setting). +It is possible to set this a little lower if you are trying to tune for short +block mining (eg p2pool) but much lower and the device will start creating +duplicate shares. + +Sample settings for valid different frequencies (last 2 values): +34:375 +36:350 +39:325 +43:300 +45:282 +47:270 +50:256 + +Frequency: +This is the clock speed of the devices. Only specific values work, 256, 270, +282 (default), 300, 325, 350 and 375. + +If you use the full curses based interface with Avalons you will get this +information: +AVA 0: 22/ 46C 60%/2400R + +The values are: +ambient temp / highest device temp set fan % / lowest detected fan RPM. + +Check the API for more detailed information. + + +BFSB, MEGABIGPOWER, AND METABANK BITFURY BOARDS +----------------------------------------------- + +Both BFSB and MegaBigPower (V2 only at this time) boards are supported with the +"bfsb" driver. Metabank boards are supported with the "metabank" driver. These +drivers are not enabled by default, since they must be run on a Raspberry Pi in +a specific hardware configuration with the boards. To enable them, you must +build with --enable-bfsb or --enable-metabank. Do not try to use these drivers +without the manufacturer-supported hardware configuration! Also note that these +drivers do not properly support thermal shutdown at this time, and without +sufficient cooling you may destroy your board or chips! + +To start BFGMiner, ensure your Raspberry Pi's SPI is enabled (you can run the +raspi-config utility for this). For Metabank boards, you must also load the I2C +drivers (do not try to modprobe both with a single command; it won't work): + modprobe i2c-bcm2708 + modprobe i2c-dev +Then you must run BFGMiner as root, with the proper driver selected. +For example: + sudo bfgminer -S bfsb:auto + + +BI*FURY +------- + +Bi*Fury should just work; you may need to use -S bifury: + +On Windows, you will need to install the standard USB CDC driver for it. + http://store.bitcoin.org.pl/support + +If you want to upgrade the firmware, unplug your device. You will need to +temporarily short a circuit. With the USB connector pointing forward, and the +heatsink down, look to the forward-right; you will see two tiny lights, a set of +2 terminals, and a set of 3 terminals. The ones you need to short are the set of +2. With them shorted, plug the device back into your computer. It will then +pretend to be a mass storage disk drive. If you use Windows, you can play along +and just overwrite the firmware.bin file. If you use Linux, you must use mcopy: + mcopy -i /dev/disk/by-id/usb-NXP_LPC1XXX_IFLASH_ISP-0:0 firmware.bin \ + ::/firmware.bin +After this is complete, unplug the device again and un-short the 2 terminals. +This completes the upgrade and you can now plug it back in and start mining. + + +BIG PICTURE MINING BITFURY USB +------------------------------ + +These miners are sensitive to unexpected data. Usually you can re-plug them to +reset to a known-good initialisation state. To ensure they are properly detected +and used with BFGMiner, you must specify -S bigpic:all (or equivalent) options +prior to any other -S options (which might probe the device and confuse it). + + +BLOCK ERUPTER BLADE +------------------- + +Blades communicate over Ethernet using the old but simple getwork mining +protocol. If you build BFGMiner with libmicrohttpd, you can have it work with +one or more blades. First, start BFGMiner with the --http-port option. For +example: + bfgminer --http-port 8330 +Then configure your blade to connect to your BFGMiner instance on the same port, +with a unique username per blade. It will then show up as a SGW device and +should work more or less like any other miner. + + +BLOCK ERUPTER USB +----------------- + +These will autodetect if supported by the device; otherwise, you need to use +the '--scan-serial erupter:' option to tell BFGMiner what device to +probe; if you know you have no other serial devices, or only ones that can +tolerate garbage, you can use '--scan-serial erupter:all' to probe all serial +ports. They communicate with the Icarus protocol, which has some additional +options in README.FPGA + + +KLONDIKE +-------- + +--klondike-options Set klondike options clock:temptarget + + +KNCMINER +-------- + +The KnC miner uses a BeagleBoneBlack(BBB) as the host, this is pluged into a +cape that holds the FPGA and connections for 4-6 ASICS depending on the cape +version. The BBB runs the Angstrom linux distribution, the following is a step +by step install for BFGMiner on this distro; + +-----------------Start------------ +cat >/etc/opkg/feeds.conf <<\EOF +src/gz noarch http://feeds.angstrom-distribution.org/feeds/v2013.06/ipk/eglibc/all/ +src/gz base http://feeds.angstrom-distribution.org/feeds/v2013.06/ipk/eglibc/cortexa8hf-vfp-neon/base/ +src/gz beaglebone http://feeds.angstrom-distribution.org/feeds/v2013.06/ipk/eglibc/cortexa8hf-vfp-neon/machine/beaglebone/ +EOF + +opkg update +opkg install angstrom-feed-configs +rm /etc/opkg/feeds.conf +opkg update + +opkg install update-alternatives +opkg install automake autoconf make gcc cpp binutils git less pkgconfig-dev ncurses-dev libtool nano bash i2c-tools-dev +while ! opkg install libcurl-dev; do true; done +ln -s aclocal-1.12 /usr/share/aclocal + +curl http://www.digip.org/jansson/releases/jansson-2.0.1.tar.bz2 | tar -xjvp +cd jansson-2.0.1 +./configure --prefix=/usr CC=arm-angstrom-linux-gnueabi-gcc --disable-static NM=arm-angstrom-linux-gnueabi-nm +make install && ldconfig +cd .. + +git clone git://github.com/luke-jr/bfgminer +cd bfgminer +./autogen.sh +git clone git://github.com/troydhanson/uthash +./configure --host=arm-angstrom-linux-gnueabi --enable-knc CFLAGS="-I$PWD/uthash/src -O0 -ggdb" +make AR=arm-angstrom-linux-gnueabi-ar + +/etc/init.d/cgminer.sh stop +./bfgminer -S knc:auto -c /config/cgminer.conf + +---------------END------------- + +BFGMiner has also been incorporated into an unofficial firmware by uski01 called Bertmod this can be found on the kncminer forum. + +--- + +This code is provided entirely free of charge by the programmer in his spare +time so donations would be greatly appreciated. Please consider donating to the +address below. + +Luke-Jr +1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh diff --git a/bfgminer3.9/share/doc/bfgminer/README.CPU b/bfgminer3.9/share/doc/bfgminer/README.CPU new file mode 100644 index 0000000..66835a9 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/README.CPU @@ -0,0 +1,45 @@ +EXECUTIVE SUMMARY ON CPU USAGE: + +By default, BFGMiner will NOT mine on CPUs unless it is explicitly compiled with +support and told to do so. CPU mining for bitcoin is generally considered to be +obsolete as it requires considerably more power per hash computed than either +GPU, FPGA or ASIC based mining. If you still wish to mine using CPUs you will +need to build a custom binary with support enabled (refer to the build notes in +README for further information). + +The following CPU mining options are available: + +--algo|-a Specify sha256 implementation for CPU mining: + fastauto* Quick benchmark at startup to pick a working algorithm + auto Benchmark at startup and pick fastest algorithm + c Linux kernel sha256, implemented in C + 4way tcatm's 4-way SSE2 implementation + via VIA padlock implementation + cryptopp Crypto++ C/C++ implementation + cryptopp_asm32 Crypto++ 32-bit assembler implementation + sse2_32 SSE2 32 bit implementation for i386 machines + sse2_64 SSE2 64 bit implementation for x86_64 machines + sse4_64 SSE4.1 64 bit implementation for x86_64 machines + altivec_4way Altivec implementation for PowerPC G4 and G5 machines +--cpu-threads|-t Number of miner CPU threads (default: 4) + +CPU FAQ: + +Q: What happened to CPU mining? +A: Being increasingly irrelevant for most users, and a maintenance issue, it is +no longer under active development and will not be supported unless someone +steps up to help maintain it. No binary builds supporting CPU mining will be +released for Windows but CPU mining can be built into BFGMiner when it is +compiled. For builds which do support CPU mining, it is still disabled by +default, and must be enabled using the -S cpu:auto option. + +Q: So, should I even try CPU mining? +A: No, it honestly will waste more power and time than it is worth at this stage. +If you really wish to mine, you are better off getting a suitable ASIC instead. + +Q: But, if the computers aren't mine and I'm not paying for the power? +A: If you are trying to use computers that aren't yours, you really should +reconsider. Attempting to mine with a large number of devices will often impact +negatively on many pools and will likely pay almost nothing due to the small +number of successful shares submitted. Apart from that, you will probably get +into trouble with someone down the track for misusing the computers. diff --git a/bfgminer3.9/share/doc/bfgminer/README.FPGA b/bfgminer3.9/share/doc/bfgminer/README.FPGA new file mode 100644 index 0000000..f60a2be --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/README.FPGA @@ -0,0 +1,297 @@ + +This README contains extended details about FPGA mining with BFGMiner + + +ModMiner (MMQ) +-------------- + +ModMiner does not have any persistent storage for bitstreams, so BFGMiner must +upload it after power on. For this to work, you must first download the +necessary bitstream file to BFGMiner's "bitstreams" directory, and give it the +name "fpgaminer_x6500-overclocker-0402.bit". You can download this bitstream +from FPGA Mining LLC's website: + http://www.fpgamining.com/documentation/firmware + +- + +If the MMQ doesn't respond to BFGMiner at all, or the red LED isn't flashing +then you will need to reset the MMQ. + +The red LED should always be flashing when it is mining or ready to mine. + +To reset the MMQ, you are best to press the left "RESET" button on the +backplane, then unplug and replug the USB cable. + +If your MMQ doesn't have a button on the "RESET" pad, you need to join the two +left pads of the "RESET" pad with conductive wire to reset it. Cutting a small +(metal) paper-clip in half works well for this. + +Then unplug the USB cable, wait for 5 seconds, then plug it back in. + +After you press reset, the red LED near the USB port should blink continuously. + +If it still wont work, power off, wait for 5 seconds, then power on the MMQ +This of course means it will upload the bitstream again when you start BFGMiner. + +- + +Device 0 is on the power end of the board. + +- + +You must make sure you have an appropriate firmware in your MMQ +Read here for official details of changing the firmware: + http://wiki.btcfpga.com/index.php?title=Firmware + +The basics of changing the firmware are: + You need two short pieces of conductive wire if your MMQ doesn't have buttons + on the "RESET" and "ISP" pads on the backplane board. + Cutting a small (metal) paper-clip in half works well for this. + + Join the 2 left pads of the "RESET" pad with wire and the led will dim. + Without disconnecting the "RESET", join the 2 left pads of the "ISP" pad with + a wire and it will stay dim. + Release "RESET" then release "ISP" and is should still be dim. + Unplug the USB and when you plug it back in it will show up as a mass storage + device. + Linux: (as one single line): + mcopy -i /dev/disk/by-id/usb-NXP_LPC134X_IFLASH_ISP000000000-0:0 + modminer091012.bin ::/firmware.bin + Windows: delete the MSD device file firmware.bin and copy in the new one + rename the new file and put it under the same name 'firmware.bin' + Disconnect the USB correctly (so writes are flushed first) + Join and then disconnect "RESET" and then plug the USB back in and it's done. + +Best to update to one of the latest 2 listed below if you don't already +have one of them in your MMQ. + +The current latest different firmware are: + + Latest for support of normal or TLM bitstream: + http://btcfpga.com/files/firmware/modminer092612-TLM.bin + + Latest with only normal bitstream support (Temps/HW Fix): + http://btcfpga.com/files/firmware/modminer091012.bin + +The code is currently tested on the modminer091012.bin firmware. +This comment will be updated when others have been tested. + +- + +On many Linux distributions there is an app called modem-manager that may cause +problems when it is enabled, due to opening the MMQ device and writing to it. + +The problem will typically present itself by the flashing led on the backplane +going out (no longer flashing) and it takes a power cycle to re-enable the MMQ +firmware - which then can lead to the problem reoccurring. + +You can either disable/uninstall modem-manager if you don't need it or: +a (hack) solution to this is to blacklist the MMQ USB device in +/lib/udev/rules.d/77-mm-usb-device-blacklist.rules + +Adding 2 lines like this (just above APC) should help. +# MMQ +ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0003", ENV{ID_MM_DEVICE_IGNORE}="1" + +The change will be lost and need to be re-done, next time you update the +modem-manager software. + + +BitForce (BFL) +-------------- + +--bfl-range Use nonce range on BitForce devices if supported + +This option is only for BitForce devices. Earlier devices such as the single +did not have any way of doing small amounts of work which meant that a lot of +work could be lost across block changes. Some of the Mini Rigs have support +for doing this, so less work is lost across a longpoll. However, it comes at +a cost of 1% in overall hashrate so this feature is disabled by default. It +is only recommended you enable this if you are mining with a Mini Rig on +P2Pool. + +BFGMiner also bundles a bitforce-firmware-flash utility on Linux. Using this, +you can change the bitstream firmware on BitForce Singles. It is untested with +other devices. Use at your own risk! Windows users may use Butterfly Labs +EasyMiner to change firmware. + +To compile: + make bitforce-firmware-flash +To flash your BFL, specify the BFL port and the flash file e.g.: + sudo ./bitforce-firmware-flash /dev/ttyUSB0 alphaminer_832.bfl +It takes a bit under 3 minutes to flash a BFL and shows a progress % counter +Once it completes, you may also need to wait about 15 seconds, then power the +BFL off and on again. + +If you get an error at the end of the BFL flash process stating: + "Error reading response from ZBX" +it may have worked successfully anyway. +Test mining on it to be sure if it worked or not. + +You need to give BFGMiner about 10 minutes mining with the BFL to be sure of +the Mh/s value reported with the changed firmware - and the MH/s reported will +be less than the firmware speed since you lose work on every block change. + + +Icarus (ICA) +------------ + +There are two hidden options in BFGMiner when Icarus support is compiled in: + +--icarus-options Set specific FPGA board configurations - one set of values for all or comma separated + baud:work_division:fpga_count:quirks + + baud The Serial/USB baud rate - 115200 or 57600 only - default 115200 + work_division The fraction of work divided up for each FPGA chip - 1, 2, 4 or 8 + e.g. 2 means each FPGA does half the nonce range - default 2 + fpga_count The actual number of FPGA working - this would normally be the same + as work_division - range is from 1 up to 'work_division' + It defaults to the value of work_division - or 2 if you don't specify + work_division + quirks List of quirks to enable and disable (after a minus sign): + r Reopen device regularly to workaround buggy Icarus USB chipset + (enabled by default) + +If you define fewer comma separated values than Icarus devices, the last values +will be used for all extra devices. + +An example would be: --icarus-options 57600:2:1:-r +This would mean: use 57600 baud, the FPGA board divides the work in half however +only 1 FPGA actually runs on the board, and don't reopen the device (e.g. like +an early CM1 Icarus copy bitstream). + +--icarus-timing Set how the Icarus timing is calculated - one setting/value for all or comma separated + default[=N] Use the default Icarus hash time (2.6316ns) + short=[N] Calculate the hash time and stop adjusting it at ~315 difficulty 1 shares (~1hr) + long=[N] Re-calculate the hash time continuously + value[=N] Specify the hash time in nanoseconds (e.g. 2.6316) and abort time (e.g. 2.6316=80) + +If you define fewer comma separated values than Icarus devices, the last values +will be used for all extra devices. + +Icarus timing is required for devices that do not exactly match a default +Icarus Rev3 in processing speed. +If you have an Icarus Rev3 you should not normally need to use --icarus-timing +since the default values will maximise the Mh/s and display it correctly. + +Icarus timing is used to determine the number of hashes that have been checked +when it aborts a nonce range (including on a longpoll). +It is also used to determine the elapsed time when it should abort a nonce +range to avoid letting the Icarus go idle, but also to safely maximise that +time. + +'short' or 'long' mode should only be used on a computer that has enough CPU +available to run BFGMiner without any CPU delays (an active desktop or swapping +computer would not be stable enough). +Any CPU delays while calculating the hash time will affect the result +'short' mode only requires the computer to be stable until it has completed +~315 difficulty 1 shares, 'long' mode requires it to always be stable to ensure +accuracy, however, over time it continually corrects itself. +The optional additional =N for 'short' or 'long' specifies the limit to set the +timeout to in deciseconds; thus if the timing code calculation is higher while +running, it will instead use the limit. +This can be set to the appropriate value to ensure the device never goes idle +even if the calculation is negatively affected by system performance. + +When in 'short' or 'long' mode, it will report the hash time value each time it +is re-calculated. +In 'short' or 'long' mode, the scan abort time starts at 5 seconds and uses the +default 2.6316ns scan hash time, for the first 5 nonces or one minute +(whichever is longer). + +In 'default' or 'value' mode the 'constants' are calculated once at the start, +based on the default value or the value specified. +The optional additional =N specifies to set the default abort at N 1/10ths of a +second, not the calculated value, which is 112 for 2.6316ns + +To determine the hash time value for a non Icarus Rev3 device or an Icarus Rev3 +with a different bitstream to the default one, use 'long' mode and give it at +least a few hundred shares, or use 'short' mode and take note of the final hash +time value (Hs) calculated. +You can also use the RPC API 'stats' command to see the current hash time (Hs) +at any time. + +The Icarus code currently only works with an FPGA device that supports the same +commands as Icarus Rev3 requires and also is less than ~840Mh/s and greater +than 2Mh/s. +If an FPGA device does hash faster than ~840Mh/s it should work correctly if +you supply the correct hash time nanoseconds value. + +The timing code itself will affect the Icarus performance since it increases +the delay after work is completed or aborted until it starts again. +The increase is, however, extremely small and the actual increase is reported +with the RPC API 'stats' command (a very slow CPU will make it more noticeable). +Using the 'short' mode will remove this delay after 'short' mode completes. +The delay doesn't affect the calculation of the correct hash time. + + +X6500 +----- + +Since X6500 FPGAs do not use serial ports for communication, the --scan-serial +option instead works with product serial numbers. By default, any devices with +the X6500 USB product id will be used, but some X6500s may have shipped without +this product id being configured. If you have any of these, you will need to +specify their serial numbers explicitly, and also add -S x6500:auto if you +still want to use the autodetection for other properly-configured FPGAs. +The serial number of X6500s is usually found on a label applied to the ATX +power connector slot. If yours is missing, devices seen by the system can be +displayed by starting bfgminer in debug mode. To get a simple list of devices, +with the debug output shown, you can use: bfgminer -D -d? -T + +X6500 does not have any persistent storage for bitstreams, so BFGMiner must +upload it after power on. For this to work, you must first download the +necessary bitstream file to BFGMiner's "bitstreams" directory, and give it the +name "fpgaminer_x6500-overclocker-0402.bit". You can download this bitstream +from FPGA Mining LLC's website: + http://www.fpgamining.com/documentation/firmware + + +ZTEX FPGA Boards +---------------- + +http://www.ztex.de sells two boards suitable for mining: the 1.15x with 1 FPGA +and the 1.15y with 4 FPGAs. ZTEX distributes their own mining software and +drivers. BFGMiner has full support for these boards, as long as they have at +least the "dummy" mining bitstreams installed on them. + +If your boards do not have a mining bitstream yet, you must first, install +ZTEX's BTCMiner (requires Java JDK version 6 or later) and install one. + +=== WINDOWS NOTE === +Upon first powering up and connecting the board via USB, windows will attempt +and fail to find the appropriate drivers. To load the initial firmware on the +board, you'll need the EZ-USB FX2 SDK from here: + http://www.ztex.de/downloads/#firmware_kit +Extract the firmware kit and use the driver within libusb-win32/ztex.inf. +Windows should now recognize the board and you're ready to program it. +=== END OF WINDOWS === + +Grab the latest miner jar from http://www.ztex.de/btcminer/#download and program +the appropriate dummy firmware for your board. The command should look +something like (for a single FPGA board): + java -cp ZtexBTCMiner-120417.jar BTCMiner -m p -f **FILENAME** -s 01-02-01 +For ZTEX 1.15x boards, the dummy bitstream filename is ztex_ufm1_15d.ihx +For ZTEX 1.15y boards, the dummy bitstream filename is ztex_ufm1_15y.ihx + +=== WINDOWS NOTE === +To mine using BFGMiner, you'll have to swap the USB drivers. The BFGMiner- +compatible WinUSB drivers for the board can be generated with this tool: + http://sourceforge.net/projects/libwdi/files/zadig/ +Basic usage instructions for Zadig can be found here: + https://github.com/pbatard/libwdi/wiki/Zadig +Once Zadig generates and installs a WinUSB driver, ensure everything is working +by running: + bfgminer -D -d? -T +You should see something like this in the output: + [2013-01-22 20:19:11] Found 1 ztex board + [2013-01-22 20:19:11] ZTX 0: Found Ztex (ZTEX 0001-02-01-1) +=== END OF WINDOWS === + +If you have installed a dummy bitstream, you will now need to copy the main +mining bitstream where BFGMiner can find it. This are usually the same as the +dummy bitstream filename, but with a number added to the end. Extract the +ZtexBTCMiner-120417.jar file using any unzip utility, and look for the proper +*.ihx and *.bit files (the latter will be inside the 'fpga' directory of the +jar). Copy them to BFGMiner's "bitstreams" directory, and you're ready to start +mining. diff --git a/bfgminer3.9/share/doc/bfgminer/README.GPU b/bfgminer3.9/share/doc/bfgminer/README.GPU new file mode 100644 index 0000000..13da387 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/README.GPU @@ -0,0 +1,486 @@ +EXECUTIVE SUMMARY ON GPU USAGE (SEE ALSO README.scrypt FOR SCRYPT MINING): + +By default, BFGMiner will NOT mine on any GPUs. If you wish to use your GPU to +mine (generally not a good idea), you can explicitly enable it with the -S +opencl:auto option. + +Single pool, regular desktop: + +bfgminer -S opencl:auto -o http://pool:port -u username -p password + +If you have configured your system properly, BFGMiner will mine on all GPUs in +"dynamic" mode which is designed to keep your system usable and sacrifice some +mining performance. + +Single pool, dedicated miner: + +bfgminer -S opencl:auto -o http://pool:port -u username -p password -I 9 + +Single pool, first card regular desktop, 3 other dedicated cards: + +bfgminer -S opencl:auto -o http://pool:port -u username -p password -I d,9,9,9 + +Multiple pool, dedicated miner: + +bfgminer -S opencl:auto -o http://pool1:port -u pool1username -p pool1password -o http://pool2:port -u pool2usernmae -p pool2password -I 9 + +Add overclocking settings, GPU and fan control for all cards: + +bfgminer -S opencl:auto -o http://pool:port -u username -p password -I 9 --auto-fan --auto-gpu --gpu-engine 750-950 --gpu-memclock 300 + +Add overclocking settings, GPU and fan control with different engine settings for 4 cards: + +bfgminer -S opencl:auto -o http://pool:port -u username -p password -I 9 --auto-fan --auto-gpu --gpu-engine 750-950,945,700-930,960 --gpu-memclock 300 + +READ WARNINGS AND DOCUMENTATION BELOW ABOUT OVERCLOCKING + +To configure multiple displays on linux you need to configure your Xorg cleanly +to use them all: + +sudo aticonfig --adapter=all -f --initial + +On Linux you virtually always need to export your display settings before +starting to get all the cards recognised and/or temperature+clocking working: + +export DISPLAY=:0 + +--- +SETUP FOR GPU SUPPORT: + +To setup GPU mining support: + +Install the AMD APP sdk, ideal version (see FAQ!) - put it into a system +location. +Download the correct version for either 32 bit or 64 bit from here: + http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/ + +The best version for Radeon 5xxx and 6xxx is v2.5, while 7xxx cards need v2.6 or +later, 2.7 seems the best. + +For versions 2.4 or earlier you will need to manually install them: +This will give you a file with a name like: + AMD-APP-SDK-v2.4-lnx64.tgz (64-bit) +or + AMD-APP-SDK-v2.4-lnx32.tgz (32-bit) + +Then: + +sudo -i +cd /opt +tar xf /path/to/AMD-APP-SDK-v2.4-lnx##.tgz +cd / +tar xf /opt/AMD-APP-SDK-v2.4-lnx##/icd-registration.tgz +ln -s /opt/AMD-APP-SDK-v2.4-lnx##/include/CL /usr/include +ln -s /opt/AMD-APP-SDK-v2.4-lnx##/lib/x86_64/* /usr/lib/ +ldconfig + +Where ## is 32 or 64, depending on the bitness of the SDK you downloaded. +If you are on 32 bit, x86_64 in the 2nd last line should be x86 + + +--- +INTENSITY INFORMATION: + +Intensity correlates with the size of work being submitted at any one time to +a GPU. The higher the number the larger the size of work. Generally speaking +finding an optimal value rather than the highest value is the correct approach +as hash rate rises up to a point with higher intensities but above that, the +device may be very slow to return responses, or produce errors. + +NOTE: Running intensities above 9 with current hardware is likely to only +diminish return performance even if the hash rate might appear better. A good +starting baseline intensity to try on dedicated miners is 9. 11 is the upper +limit for intensity while Bitcoin mining, if the GPU_USE_SYNC_OBJECTS variable +is set (see FAQ). The upper limit for SHA256d mining is 14 and 20 for scrypt. + + +--- +OVERCLOCKING WARNING AND INFORMATION + +AS WITH ALL OVERCLOCKING TOOLS YOU ARE ENTIRELY RESPONSIBLE FOR ANY HARM YOU +MAY CAUSE TO YOUR HARDWARE. OVERCLOCKING CAN INVALIDATE WARRANTIES, DAMAGE +HARDWARE AND EVEN CAUSE FIRES. THE AUTHOR ASSUMES NO RESPONSIBILITY FOR ANY +DAMAGE YOU MAY CAUSE OR UNPLANNED CHILDREN THAT MAY OCCUR AS A RESULT. + +The GPU monitoring, clocking and fanspeed control incorporated into BFGMiner +comes through use of the ATI Display Library. As such, it only supports ATI +GPUs. Even if ADL support is successfully built into BFGMiner, unless the card +and driver supports it, no GPU monitoring/settings will be available. + +BFGMiner supports initial setting of GPU engine clock speed, memory clock +speed, voltage, fanspeed, and the undocumented powertune feature of 69x0+ GPUs. +The setting passed to BFGMiner is used by all GPUs unless separate values are +specified. All settings can all be changed within the menu on the fly on a +per-GPU basis. + +For example: +--gpu-engine 950 --gpu-memclock 825 + +will try to set all GPU engine clocks to 950 and all memory clocks to 825, +while: +--gpu-engine 950,945,930,960 --gpu-memclock 300 + +will try to set the engine clock of card 0 to 950, 1 to 945, 2 to 930, 3 to +960 and all memory clocks to 300. + +You can substitute 0 to leave the engine clock of a card at its default. +For example, to keep the 2nd GPU to its default clocks: +--gpu-engine 950,0,930,960 --gpu-memclock 300,0,300,300 + +AUTO MODES: +There are two "auto" modes in BFGMiner, --auto-fan and --auto-gpu. These can be +used independently of each other and are complementary. Both auto modes are +designed to safely change settings while trying to maintain a target +temperature. By default this is set to 75 degrees C but can be changed with: + +--temp-target +e.g. +--temp-target 80 +Sets all cards' target temperature to 80 degrees. + +--temp-target 75,85 +Sets card 0 target temperature to 75, and card 1 to 85 degrees. + +AUTO FAN: +e.g. +--auto-fan (implies 85% upper limit) +--gpu-fan 25-85,65 --auto-fan + +Fan control in auto fan works off the theory that the minimum possible fan +required to maintain an optimal temperature will use less power, make less +noise, and prolong the life of the fan. In auto-fan mode, the fan speed is +limited to 85% if the temperature is below "overheat" intentionally, as higher +fanspeeds on GPUs do not produce signficantly more cooling, yet significantly +shorten the lifespan of the fans. If temperature reaches the overheat value, +fanspeed will still be increased to 100%. The overheat value is set to 85 +degrees by default and can be changed with: + +--temp-overheat +e.g. +--temp-overheat 75,85 +Sets card 0 overheat threshold to 75 degrees and card 1 to 85. + +AUTO GPU: +e.g. +--auto-gpu --gpu-engine 750-950 +--auto-gpu --gpu-engine 750-950,945,700-930,960 + +GPU control in auto gpu tries to maintain as high a clock speed as possible +while not reaching overheat temperatures. As a lower clock speed limit, the +auto-gpu mode checks the GPU card's "normal" clock speed and will not go below +this unless you have manually set a lower speed in the range. Also, unless a +higher clock speed was specified at startup, it will not raise the clockspeed. +If the temperature climbs, fanspeed is adjusted and optimised before GPU engine +clockspeed is adjusted. If fan speed control is not available or already +optimal, then GPU clock speed is only decreased if it goes over the target +temperature by the hysteresis amount, which is set to 3 by default and can be +changed with: +--temp-hysteresis +If the temperature drops below the target temperature, and engine clock speed +is not at the highest level set at startup, BFGMiner will raise the clock speed. +If at any time you manually set an even higher clock speed successfully in +BFGMiner, it will record this value and use it as its new upper limit (and the +same for low clock speeds and lower limits). If the temperature goes over the +cutoff limit (95 degrees by default), BFGMiner will completely disable the GPU +from mining and it will not be re-enabled unless manually done so. The cutoff +temperature can be changed with: + +--temp-cutoff +e.g. +--temp-cutoff 95,105 +Sets card 0 cutoff temperature to 95 and card 1 to 105. + +--gpu-memdiff -125 +This setting will modify the memory speed whenever the GPU clock speed is +modified by --auto-gpu. In this example, it will set the memory speed to be 125 +MHz lower than the GPU speed. This is useful for some cards like the 6970 which +normally don't allow a bigger clock speed difference. The 6970 is known to only +allow -125, while the 7970 only allows -150. + + +CHANGING SETTINGS: +When setting values, it is important to realise that even though the driver +may report the value was changed successfully, and the new card power profile +information contains the values you set it to, that the card itself may +refuse to use those settings. As the performance profile changes dynamically, +querying the "current" value on the card can be wrong as well. So when changing +values in BFGMiner, after a pause of 1 second, it will report to you the current +values where you should check that your change has taken. An example is that +6970 reference cards will accept low memory values but refuse to actually run +those lower memory values unless they're within 125 of the engine clock speed. +In that scenario, they usually set their real speed back to their default. + +BFGMiner reports the so-called "safe" range of whatever it is you are modifying +when you ask to modify it on the fly. However, you can change settings to values +outside this range. Despite this, the card can easily refuse to accept your +changes, or worse, to accept your changes and then silently ignore them. So +there is absolutely to know how far to/from where/to it can set things safely or +otherwise, and there is nothing stopping you from at least trying to set them +outside this range. Being very conscious of these possible failures is why +BFGMiner will report back the current values for you to examine how exactly the +card has responded. Even within the reported range of accepted values by the +card, it is very easy to crash just about any card, so it cannot use those +values to determine what range to set. You have to provide something meaningful +manually for BFGMiner to work with through experimentation. + +STARTUP / SHUTDOWN: +When BFGMiner starts up, it tries to read off the current profile information +for clock and fan speeds and stores these values. When quitting BFGMiner, it +will then try to restore the original values. Changing settings outside of +BFGMiner while it's running may be reset to the startup BFGMiner values when +BFGMiner shuts down because of this. + +--- + +GPU DEVICE ISSUES and use of --gpu-map + +GPUs mine with OpenCL software via the GPU device driver. This means you need +to have both an OpenCL SDK installed, and the GPU device driver RUNNING (i.e. +Xorg up and running configured for all devices that will mine on linux etc.) +Meanwhile, the hardware monitoring that BFGMiner offers for AMD devices relies +on the ATI Display Library (ADL) software to work. OpenCL DOES NOT TALK TO THE +ADL. There is no 100% reliable way to know that OpenCL devices are identical +to the ADL devices, as neither give off the same information. BFGMiner does its +best to correlate these devices based on the order that OpenCL and ADL numbers +them. It is possible that this will fail for the following reasons: + +1. The device order is listed differently by OpenCL and ADL (rare), even if the +number of devices is the same. +2. There are more OpenCL devices than ADL. OpenCL stupidly sees one GPU as two +devices if you have two monitors connected to the one GPU. +3. There are more ADL devices than OpenCL. ADL devices include any ATI GPUs, +including ones that can't mine, like some older R4xxx cards. + +To cope with this, the ADVANCED option for --gpu-map is provided with BFGMiner. +DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. The default will work the +vast majority of the time unless you know you have a problem already. + +To get useful information, start BFGMiner with just the -n option. You will get +output that looks like this: + +[2012-04-25 13:17:34] CL Platform 0 vendor: Advanced Micro Devices, Inc. +[2012-04-25 13:17:34] CL Platform 0 name: AMD Accelerated Parallel Processing +[2012-04-25 13:17:34] CL Platform 0 version: OpenCL 1.1 AMD-APP (844.4) +[2012-04-25 13:17:34] Platform 0 devices: 3 +[2012-04-25 13:17:34] 0 Tahiti +[2012-04-25 13:17:34] 1 Tahiti +[2012-04-25 13:17:34] 2 Cayman +[2012-04-25 13:17:34] GPU 0 AMD Radeon HD 7900 Series hardware monitoring enabled +[2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series hardware monitoring enabled +[2012-04-25 13:17:34] GPU 2 AMD Radeon HD 6900 Series hardware monitoring enabled +[2012-04-25 13:17:34] 3 GPU devices max detected + +Note the number of devices here match, and the order is the same. If devices 1 +and 2 were different between Tahiti and Cayman, you could run BFGMiner with: +--gpu-map 2:1,1:2 +And it would swap the monitoring it received from ADL device 1 and put it to +OpenCL device 2 and vice versa. + +If you have 2 monitors connected to the first device it would look like this: + +[2012-04-25 13:17:34] Platform 0 devices: 4 +[2012-04-25 13:17:34] 0 Tahiti +[2012-04-25 13:17:34] 1 Tahiti +[2012-04-25 13:17:34] 2 Tahiti +[2012-04-25 13:17:34] 3 Cayman +[2012-04-25 13:17:34] GPU 0 AMD Radeon HD 7900 Series hardware monitoring enabled +[2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series hardware monitoring enabled +[2012-04-25 13:17:34] GPU 2 AMD Radeon HD 6900 Series hardware monitoring enabled + +To work around this, you would use: +-d 0 -d 2 -d 3 --gpu-map 2:1,3:2 + +If you have an older card as well as the rest it would look like this: + +[2012-04-25 13:17:34] Platform 0 devices: 3 +[2012-04-25 13:17:34] 0 Tahiti +[2012-04-25 13:17:34] 1 Tahiti +[2012-04-25 13:17:34] 2 Cayman +[2012-04-25 13:17:34] GPU 0 AMD Radeon HD 4500 Series hardware monitoring enabled +[2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series hardware monitoring enabled +[2012-04-25 13:17:34] GPU 2 AMD Radeon HD 7900 Series hardware monitoring enabled +[2012-04-25 13:17:34] GPU 3 AMD Radeon HD 6900 Series hardware monitoring enabled + +To work around this you would use: +--gpu-map 0:1,1:2,2:3 + + +--- +GPU FAQ: + +Q: Can I change the intensity settings individually for each GPU? +A: Yes, pass a list separated by commas such as -I d,4,9,9 + +Q: The CPU usage is high. +A: The ATI drivers after 11.6 have a bug that makes them consume 100% of one +CPU core unnecessarily, so downgrade to 11.6. Binding BFGMiner to one CPU core +on windows can minimise it to 100% (instead of more than one core). Driver +version 11.11 on linux and 11.12 on windows appear to have fixed this issue. +Note that later drivers may have an apparent return of high CPU usage. Try +'export GPU_USE_SYNC_OBJECTS=1' on Linux before starting BFGMiner. You can also +set this variable in windows via a batch file or on the command line before +starting BFGMiner with 'setx GPU_USE_SYNC_OBJECTS 1' + +Q: My GPU hangs and I have to reboot it to get it going again? +A: The more aggressively the mining software uses your GPU, the less overclock +you will be able to run. You are more likely to hit your limits with BFGMiner +and you will find you may need to overclock your GPU less aggressively. The +software cannot be responsible and make your GPU hang directly. If you simply +cannot get it to ever stop hanging, try decreasing the intensity, and if even +that fails, try changing to the poclbm kernel with -k poclbm, though you will +sacrifice performance. BFGMiner is designed to try and safely restart GPUs as +much as possible, but NOT if that restart might actually crash the rest of the +GPUs mining, or even the machine. It tries to restart them with a separate +thread and if that separate thread dies, it gives up trying to restart any more +GPUs. + +Q: Can you change the autofan/autogpu to change speeds in a different manner? +A: The defaults are sane and safe. I'm not interested in changing them further. +The starting fan speed is set to 50% in auto-fan mode as a safety precaution. + +Q: I upgraded BFGMiner version and my hashrate suddenly dropped! +A: No, you upgraded your SDK version unwittingly between upgrades of BFGMiner +and that caused your hashrate to drop. Please see the next question. + +Q: I upgraded my ATI driver/SDK/BFGMiner and my hashrate suddenly dropped! +A: The hashrate performance in BFGMiner is tied to the version of the ATI SDK +that is installed only for the very first time BFGMiner is run. This generates +binaries that are used by the GPU every time after that. Any upgrades to the +SDK after that time will have no effect on the binaries. However, if you +install a fresh version of BFGMiner, and have since upgraded your SDK, new +binaries will be built. It is known that the 2.6 ATI SDK has a huge hashrate +penalty on generating new binaries. It is recommended to not use this SDK at +this time unless you are using an ATI 7xxx card that needs it. + +Q: Which AMD SDK is the best for BFGMiner? +A: At the moment, versions 2.4 and 2.5 work the best for 5xxx and 6xxx GPUs. SDK +2.6 or 2.7 works best for 7xxx. SDK 2.8 is known to have many problems. If you +need to use the 2.6+ SDK (7xxx and later), the phatk kernel will perform poorly, +while the diablo or (modified) poclbm kernel are optimised for it. + +Q: Which AMD driver is the best? +A: Unfortunately AMD has a history of having quite a few releases with issues +when it comes to mining, either in terms of breaking mining, increasing CPU +usage or very low hashrates. Only experimentation can tell you for sure, but +some good releases were 11.6, 11.12, 12.4 and 12.8. Note that older cards may +not work with the newer drivers. + +Q: I have multiple SDKs installed, can I choose which one it uses? +A: Run bfgminer with the -n option and it will list all the platforms currently +installed. Then you can tell BFGMiner which platform to use with --gpu-platform. + +Q: BFGMiner reports no devices or only one device on startup on Linux although +I have multiple devices and drivers+SDK installed properly? +A: Try "export DISPLAY=:0" before running BFGMiner. + +Q: BFGMiner crashes immediately on startup. +A: One of the common reasons for this is that you have mixed files on your +machine for the driver or SDK. Windows has a nasty history of not cleanly +uninstalling files so you may have to use third party tools like driversweeper +to remove old versions. The other common reason for this is windows antivirus +software is disabling one of the DLLs from working. If BFGMiner starts with the +-T option but never starts without it, this is a sure fire sign you have this +problem and will have to disable your antivirus or set up some exceptions in it +if possible. + +Q: Is it faster to mine on Windows or Linux? +A: It makes no difference. It comes down to choice of operating system for their +various features. Linux offers much better long term stability and remote +monitoring and security, while Windows offers you overclocking tools that can +achieve much more than BFGMiner can do on Linux. + +Q: BFGMiner cannot see any of my GPUs even though I have configured them all to +be enabled and installed OpenCL (+/- Xorg is running and the DISPLAY variable is +exported on Linux)? +A: Check the output of 'bfgminer -S opencl:auto -d?', it will list what OpenCL +devices your installed SDK recognises. If it lists none, you have a problem with +your version or installation of the SDK. + +Q: BFGMiner is mining on the wrong GPU, I want it on the AMD but it's mining on +my on board GPU? +A: Make sure the AMD OpenCL SDK is installed, check the output of 'bfgminer -S +opencl:auto -d?' and use the appropriate parameter with --gpu-platform. + +Q: I'm getting much lower hashrates than I should be for my GPU? +A: Look at your driver/SDK combination and disable power saving options for your +GPU. Specifically look to disable ULPS. Make sure not to set intensity above 11 +for Bitcoin mining. + +Q: Can I mine with AMD while running Nvidia or Intel GPUs at the same time? +A: If you can install both drivers successfully (easier on windows) then yes, +using the --gpu-platform option. + +Q: Can I mine with Nvidia or Intel GPUs? +A: Yes, but the hashrate on these is very poor and it is likely you'll be using +much more energy than you'll be earning in coins. + +Q: Can I mine on both Nvidia and AMD GPUs at the same time? +A: No, you must run one instance of BFGMiner with the --gpu-platform option for +each. + +Q: Can I mine on Linux without running Xorg? +A: With Nvidia you can, but with AMD you cannot. + +Q: I'm trying to mine a scrypt cryptocurrency but BFGMiner shows MH values +instead of kH and submits no shares? +A: Add the --scrypt parameter to your BFGMiner startup command. + +Q: I can't get anywhere near enough hashrate for scrypt compared to other +people? +A: You may not have enough system RAM, as this is also required. + +Q: My scrypt hashrate is high but the pool reports only a tiny proportion of my +hashrate? +A: You are generating garbage hashes due to your choice of settings. Try +decreasing your intensity, do not increase the number of gpu-threads, and +consider adding system RAM to match your GPU ram. You may also be using a bad +combination of driver and/or SDK. + +Q: Scrypt fails to initialise the kernel every time? +A: Your parameters are too high. Don't add GPU threads, don't set intensity too +high, decrease thread concurrency. See the README.scrypt for a lot more help. + +Q: BFGMiner stops mining (or my GPUs go DEAD) and I can't close it? +A: Once the driver has crashed, there is no way for BFGMiner to close cleanly. +You will have to kill it, and depending on how corrupted your driver state has +gotten, you may even need to reboot. Windows is known to reset drivers when they +fail and BFGMiner will be stuck trying to use the old driver instance. + +Q: I can't get any monitoring of temperatures or fanspeed with BFGMiner when I +start it remotely? +A: With Linux, make sure to export the DISPLAY variable. On Windows, you cannot +access these monitoring values via RDP. This should work with TightVNC or +TeamViewer, though. + +Q: I change my GPU engine/memory/voltage and BFGMiner reports back no change? +A: BFGMiner asks the GPU using the ATI Display Library to change settings, but +the driver and hardware are free to do what it wants with that query, including +ignoring it. Some GPUs are locked with one or more of those properties as well. +The most common of these is that many GPUs only allow a fixed difference +between the engine clock speed and the memory clock speed (such as the memory +being no lower than the engine - 150). Other 3rd party tools have unofficial +data on these devices on windows and can get the memory clock speed down +further but BFGMiner does not have access to these means. + +Q: I have multiple GPUs and although many devices show up, it appears to be +working only on one GPU splitting it up. +A: Your driver setup is failing to properly use the accessory GPUs. Your driver +may be misconfigured or you have a driver version that needs a dummy plug on all +the GPUs that aren't connected to a monitor. + +Q: I have some random GPU performance related problem not addressed above. +A: Seriously, it's the driver and/or SDK. Uninstall them and start again, +also noting there is no clean way to uninstall them so you will likely have to +use extra tools or do it manually. + +Q: Do I need to recompile after updating my driver/SDK? +A: No. The software is unchanged regardless of which driver/SDK/ADL version you +are running. + +Q: I do not want BFGMiner to modify my engine/clock/fanspeed? +A: BFGMiner only modifies values if you tell it to via the parameters. +Otherwise it will just monitor the values. + +Q: Should I use crossfire/SLI? +A: It does not benefit mining at all and depending on the GPU may actually +worsen performance. diff --git a/bfgminer3.9/share/doc/bfgminer/README.RPC b/bfgminer3.9/share/doc/bfgminer/README.RPC new file mode 100644 index 0000000..eb47248 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/README.RPC @@ -0,0 +1,1693 @@ + +This README contains details about the BFGMiner RPC API + +It also includes some detailed information at the end, +about using miner.php + + +If you start BFGMiner with the "--api-listen" option, it will listen on a +simple TCP/IP socket for single string API requests from the same machine +running BFGMiner and reply with a string and then close the socket each time +If you add the "--api-network" option, it will accept API requests from any +network attached computer. + +You can only access the commands that reply with data in this mode. +By default, you cannot access any privileged command that affects the miner - +you will receive an access denied status message instead. See --api-allow below +for more details. + +You can specify IP addresses/prefixes that are only allowed to access the API +with the "--api-allow" option, e.g. --api-allow W:192.168.0.1,10.0.0/24 +will allow 192.168.0.1 or any address matching 10.0.0.*, but nothing else. +IP addresses are automatically padded with extra '.0's as needed +Without a /prefix is the same as specifying /32. +0/0 means all IP addresses. +The 'W:' on the front gives that address/subnet privileged access to commands +that modify BFGMiner (thus all API commands). +Without it those commands return an access denied status. +See --api-groups below to define other groups like W: +Privileged access is checked in the order the IP addresses were supplied to +"--api-allow" +The first match determines the privilege level. +Using the "--api-allow" option overrides the "--api-network" option if they +are both specified +With "--api-allow", 127.0.0.1 is not by default given access unless specified + +If you start BFGMiner also with the "--api-mcast" option, it will listen for +a multicast message and reply to it with a message containing it's API port +number, but only if the IP address of the sender is allowed API access. + +More groups (like the privileged group W:) can be defined using the +--api-groups command +Valid groups are only the letters A-Z (except R & W are predefined) and are +not case sensitive. +The R: group is the same as not privileged access. +The W: group is (as stated) privileged access (thus all API commands). +To give an IP address/subnet access to a group you use the group letter +in front of the IP address instead of W: e.g. P:192.168.0/32 +An IP address/subnet can only be a member of one group. +A sample API group would be: + --api-groups + P:switchpool:enablepool:addpool:disablepool:removepool:poolpriority:* +This would create a group 'P' that can do all current pool commands and all +non-privileged commands - the '*' means all non-privileged commands. +Without the '*' the group would only have access to the pool commands. +Defining multiple groups example: + --api-groups Q:quit:restart:*,S:save +This would define 2 groups: + Q: that can 'quit' and 'restart' as well as all non-privileged commands. + S: that can only 'save' and no other commands. + +The RPC API request can be either simple text or JSON. + +If the request is JSON (starts with '{'), it will reply with a JSON formatted +response, otherwise it replies with text formatted as described further below. + +The JSON request format required is '{"command":"CMD","parameter":"PARAM"}' +(though of course parameter is not required for all requests) +where "CMD" is from the "Request" column below and "PARAM" would be e.g. +the CPU/GPU number if required. + +An example request in both formats to set GPU 0 fan to 80%: + gpufan|0,80 + {"command":"gpufan","parameter":"0,80"} + +The format of each reply (unless stated otherwise) is a STATUS section +followed by an optional detail section. + +From API version 1.7 onwards, reply strings in JSON and Text have the +necessary escaping as required to avoid ambiguity - they didn't before 1.7. +For JSON the 2 characters '"' and '\' are escaped with a '\' before them. +For Text the 4 characters '|' ',' '=' and '\' are escaped the same way. + +Only user entered information will contain characters that require being +escaped, such as Pool URL, User and Password or the Config save filename, +when they are returned in messages or as their values by the API. + +For API version 1.4 and later: + +The STATUS section is: + + STATUS=X,When=NNN,Code=N,Msg=string,Description=string| + + STATUS=X Where X is one of: + W - Warning + I - Informational + S - Success + E - Error + F - Fatal (code bug) + + When=NNN + Standard long time of request in seconds. + + Code=N + Each unique reply has a unique Code (See api.c - #define MSG_NNNNNN). + + Msg=string + Message matching the Code value N. + + Description=string + This defaults to the BFGMiner version but is the value of --api-description + if it was specified at runtime. + +For API version 1.10 and later: + +The list of requests - a (*) means it requires privileged access - and replies: + + Request Reply Section Details + ------- ------------- ------- + version VERSION CGMiner=BFGMiner version + API=API version + + config CONFIG Some miner configuration information: + GPU Count=N, <- the number of GPUs + PGA Count=N, <- the number of PGAs + CPU Count=N, <- the number of CPUs + Pool Count=N, <- the number of Pools + ADL=X, <- Y or N if ADL is compiled in the code + ADL in use=X, <- Y or N if any GPU has ADL + Strategy=Name, <- the current pool strategy + Log Interval=N, <- log interval (--log N) + Device Code=GPU ICA , <- spaced list of compiled + device drivers + OS=Linux/Apple/..., <- operating System + Failover-Only=true/false, <- failover-only setting + ScanTime=N, <- --scan-time setting + Queue=N, <- --queue setting + Expiry=N| <- --expiry setting + + summary SUMMARY The status summary of the miner + e.g. Elapsed=NNN,Found Blocks=N,Getworks=N,...| + + pools POOLS The status of each pool e.g. + Pool=0,URL=http://pool.com:6311,Status=Alive,...| + + devs DEVS Each available GPU, PGA and CPU with their status + e.g. GPU=0,Accepted=NN,MHS av=NNN,...,Intensity=D| + Last Share Time=NNN, <- standard long time in sec + (or 0 if none) of last accepted share + Last Share Pool=N, <- pool number (or -1 if none) + Last Valid Work=NNN, <- standand long time in sec + of last work returned that wasn't an HW: + Will not report PGAs if PGA mining is disabled + Will not report CPUs if CPU mining is disabled + + procs DEVS The details of each processor in the same format + and details as for DEVS + + devscan|info DEVS Probes for a device specified by info, which is + the same format as the --scan-serial command line + option + + gpu|N GPU The details of a single GPU number N in the same + format and details as for DEVS + + pga|N PGA The details of a single PGA number N in the same + format and details as for DEVS + This is only available if PGA mining is enabled + Use 'pgacount' or 'config' first to see if there + are any + + proc|N PGA The details of a single processor number N in the + same format and details as for DEVS + + cpu|N CPU The details of a single CPU number N in the same + format and details as for DEVS + This is only available if CPU mining is enabled + Use 'cpucount' or 'config' first to see if there are any + + gpucount GPUS Count=N| <- the number of GPUs + + pgacount PGAS Count=N| <- the number of PGAs + Always returns 0 if PGA mining is disabled + + proccount PGAS Count=N| <- the number of processors + + cpucount CPUS Count=N| <- the number of CPUs + Always returns 0 if CPU mining is disabled + + switchpool|N (*) + none There is no reply section just the STATUS section + stating the results of switching pool N to the + highest priority (the pool is also enabled) + The Msg includes the pool URL + + enablepool|N (*) + none There is no reply section just the STATUS section + stating the results of enabling pool N + The Msg includes the pool URL + + addpool|URL,USR,PASS (*) + none There is no reply section just the STATUS section + stating the results of attempting to add pool N + The Msg includes the pool URL + Use '\\' to get a '\' and '\,' to include a comma + inside URL, USR or PASS + + poolpriority|N,... (*) + none There is no reply section just the STATUS section + stating the results of changing pool priorities + See usage below + + poolquota|N,Q (*) + none There is no reply section just the STATUS section + stating the results of changing pool quota to Q + + disablepool|N (*) + none There is no reply section just the STATUS section + stating the results of disabling pool N + The Msg includes the pool URL + + removepool|N (*) + none There is no reply section just the STATUS section + stating the results of removing pool N + The Msg includes the pool URL + N.B. all details for the pool will be lost + + cpuenable|N (*) + none There is no reply section just the STATUS section + stating the results of the enable request + + cpudisable|N (*) + none There is no reply section just the STATUS section + stating the results of the disable request + + cpurestart|N (*) + none There is no reply section just the STATUS section + stating the results of the restart request + + gpuenable|N (*) + none There is no reply section just the STATUS section + stating the results of the enable request + + gpudisable|N (*) + none There is no reply section just the STATUS section + stating the results of the disable request + + gpurestart|N (*) + none There is no reply section just the STATUS section + stating the results of the restart request + + gpuintensity|N,I (*) + none There is no reply section just the STATUS section + stating the results of setting GPU N intensity + to I + + gpumem|N,V (*) + none There is no reply section just the STATUS section + stating the results of setting GPU N memoryclock + to V MHz + + gpuengine|N,V (*) + none There is no reply section just the STATUS section + stating the results of setting GPU N clock + to V MHz + + gpufan|N,V (*) + none There is no reply section just the STATUS section + stating the results of setting GPU N fan speed + to V% + + gpuvddc|N,V (*) + none There is no reply section just the STATUS section + stating the results of setting GPU N vddc to V + + save|filename (*) + none There is no reply section just the STATUS section + stating success or failure saving the BFGMiner + config to filename + The filename is optional and will use the BFGMiner + default if not specified + + quit (*) none There is no status section but just a single "BYE" + reply before BFGMiner quits + + notify NOTIFY The last status and history count of each devices + problem + e.g. NOTIFY=0,Name=PGA,ID=0,ProcID=0,Last Well=1332432290,...| + + privileged (*) + none There is no reply section just the STATUS section + stating an error if you do not have privileged + access to the API and success if you do have + privilege + The command doesn't change anything in BFGMiner + + pgaenable|N (*) + none There is no reply section just the STATUS section + stating the results of the enable request + You cannot enable a PGA if its status is not WELL + This is only available if PGA mining is enabled + + pgadisable|N (*) + none There is no reply section just the STATUS section + stating the results of the disable request + This is only available if PGA mining is enabled + + pgaidentify|N (*) + none This is equivalent to PROCIDENTIFY on the first + processor of any given device + This is only available if PGA mining is enabled + + procenable|N (*) + none There is no reply section just the STATUS section + stating the results of the enable request + + procdisable|N (*) + none There is no reply section just the STATUS section + stating the results of the disable request + + procidentify|N (*) + none There is no reply section just the STATUS section + stating the results of the identify request + On most supported devices, it will flash the led + for approximately 4s + All unsupported devices, it will return a warning + status message stating that they don't support it + For BFL, this adds a 4s delay to the share being + processed so you may get a message stating that + processing took longer than 7000ms if the request + was sent towards the end of the timing of any work + being worked on + e.g.: BFL0: took 8438ms - longer than 7000ms + You should ignore this + + devdetails DEVDETAILS Each device with a list of their static details + This lists all devices including those not + supported by the 'devs' command + e.g. DEVDETAILS=0,Name=BFL,ID=0,ProcID=0,Driver=bitforce,...| + + restart (*) none There is no status section but just a single + "RESTART" reply before BFGMiner restarts + + stats STATS Each device or pool that has 1 or more getworks + with a list of stats regarding getwork times + The values returned by stats may change in future + versions thus would not normally be displayed + Device drivers are also able to add stats to the + end of the details returned + + check|cmd COMMAND Exists=Y/N, <- 'cmd' exists in this version + Access=Y/N| <- you have access to use 'cmd' + + failover-only|true/false (*) + none There is no reply section just the STATUS section + stating what failover-only was set to + + coin COIN Coin mining information: + Hash Method=sha256/scrypt, + Current Block Time=N.N, <- 0 means none + Current Block Hash=XXXX..., <- blank if none + LP=true/false, <- LP is in use on at least 1 pool + Network Difficulty=NN.NN| + + debug|setting (*) + DEBUG Debug settings + The optional commands for 'setting' are the same + as the screen curses debug settings + You can only specify one setting + Only the first character is checked - case + insensitive: + Silent, Quiet, Verbose, Debug, RPCProto, + PerDevice, WorkTime, Normal + The output fields are (as above): + Silent=true/false, + Quiet=true/false, + Verbose=true/false, + Debug=true/false, + RPCProto=true/false, + PerDevice=true/false, + WorkTime=true/false| + + setconfig|name,value (*) + none There is no reply section just the STATUS section + stating the results of setting 'name' + The valid values for name are currently: + queue, scantime, expiry (integer in the range + 0 to 9999) + coinbase-sig (string) + + pgaset|N,opt[,val] (*) + none This is equivalent to PROCSET on the first + processor of any given device + This is only available if PGA mining is enabled + + procset|N,opt[,val] (*) + none There is no reply section just the STATUS section + stating the results of setting processor N with + opt[,val] + + If the processor does not support any set options, + it will always return a WARN stating pgaset isn't + supported + + If opt=help it will return an INFO status with a + help message about the options available + + The current options are: + MMQ opt=clock val=2 to 250 (a multiple of 2) + XBS opt=clock val=2 to 250 (a multiple of 2) + + zero|Which,true/false (*) + none There is no reply section just the STATUS section + stating that the zero, and optional summary, was + done + If Which='all', all normal BFGMiner and API + statistics will be zeroed other than the numbers + displayed by the stats command + If Which='bestshare', only the 'Best Share' values + are zeroed for each pool and the global + 'Best Share' + The true/false option determines if a full summary + is shown on the BFGMiner display like is normally + displayed on exit. + +When you enable, disable or restart a GPU or PGA, you will also get Thread +messages in the BFGMiner status window. + +The 'poolpriority' command can be used to reset the priority order of multiple +pools with a single command - 'switchpool' only sets a single pool to first +priority. Each pool should be listed by id number in order of preference (first += most preferred). Any pools not listed will be prioritised after the ones that +are listed, in the priority order they were originally If the priority change +affects the miner's preference for mining, it may switch immediately. + +When you switch to a different pool to the current one (including by priority +change), you will get a 'Switching to URL' message in the BFGMiner status +windows. + +Obviously, the JSON format is simply just the names as given before the '=' +with the values after the '='. + +If you enable BFGMiner debug (--debug or using RPC), you will also get messages +showing some details of the requests received and the replies. + +There are included 5 program examples for accessing the API: + +api-example.php - a PHP script to access the API. + usage: php api-example.php command + by default it sends a 'summary' request to the miner at 127.0.0.1:4028 + If you specify a command it will send that request instead. + You must modify the line "$socket = getsock('127.0.0.1', 4028);" at the + beginning of "function request($cmd)" to change where it looks for BFGMiner. + +api-example.c - a 'C' program to access the API (with source code). + usage: api-example [command [ip/host [port]]] + again, as above, missing or blank parameters are replaced as if you entered: + api-example summary 127.0.0.1 4028 + +miner.php - an example web page to access the API. + This includes buttons and inputs to attempt access to the privileged commands. + See the end of this README.RPC for details of how to tune the display + and also to use the option to display a multi-rig summary. + +api-example.py - a Python script to access the API. + usage: python api-example.py [--host HOST] [--port PORT] [command] [parameter] + by default it sends a 'summary' request to the miner at 127.0.0.1:4028 + If you specify a command it will send that request instead. + +---------- + +Feature Changelog for external applications using the API: + + +API V2.3 (BFGMiner v3.7.0) + +Modified API command: + 'devdetails' - Add 'Processors', 'Manufacturer', 'Product', 'Serial', + 'Target Temperature', 'Cutoff Temperature' + 'procdetails' - Add 'Manufacturer', 'Product', 'Serial', 'Target Temperature', + 'Cutoff Temperature' + +--------- + +API V2.2 (BFGMiner v3.6.0) + +Modified API command: + 'pools' - add 'Works' + +--------- + +API V2.1 (BFGMiner v3.4.0) + +Added API command: + 'poolquota' - Set pool quota for load-balance strategy. + +Modified API command: + 'devs', 'gpu', 'pga', 'procs' and 'asc' - add 'Device Elapsed', 'Stale', + 'Work Utility', 'Difficulty Stale' + 'pools' - add 'Quota' + 'summary' - add 'Diff1 Work', 'MHS %ds' (where %d is the log interval) + +--------- + +API V2.0 (BFGMiner v3.3.0) + +Removed API commands: + 'devdetail' - Use newer 'devdetails' for same information. + +Modified API commands: + 'devs' - display status of each full device only (not processors) + 'pga' - lookup and display device by device (not processor) number + 'pgacount' - count only full devices (not processors) + 'pgaenable' - enable all processors for a numbered full device + 'pgadisable' - disable all processors for a numbered full device + 'pgaidentify' - choose first processor of numbered full device + 'pgaset' - choose first processor of numbered full device + +Added API commands: + 'procs' + 'proc' + 'proccount' + 'procenable' + 'procdisable' + 'procidentify' + 'procset' + +---------- + +API V1.25.3 (BFGMiner v3.2.0) + +Modified API commands: + 'devs', 'pga', 'gpu' - add 'Device Hardware%' and 'Device Rejected%' + 'pools' - add 'Pool Rejected%' and 'Pool Stale%' + 'setconfig' - add 'http-port' number + 'summary' - add 'Device Hardware%', 'Device Rejected%', 'Pool Rejected%', + 'Pool Stale%' + +Removed output limitation: + All replies can now be longer than the previous limitation of 64k, and will + only be truncated on a 50ms timeout sending. + +Basic support for cgminer-compatible multicast RPC detection added. + +---------- + +API V1.25.2 (BFGMiner v3.1.4) + +Modified API commands: + 'pgaset' - added: XBS opt=clock val=2 to 250 (and a multiple of 2) + +---------- + +API V1.25.1 (BFGMiner v3.1.2) + +Added API commands: + 'devscan' + +---------- + +API V1.25 (BFGMiner v3.0.1) + +Modified API commands: + 'devs' 'gpu' and 'pga' - add 'Last Valid Work' + +---------- + +API V1.24.1 (BFGMiner v3.0.0) + +Modified API commands: + 'cpustatus' - add 'ProcID' + 'gpustatus' - add 'ProcID' + 'pgastatus' - add 'ProcID' + 'devstatus' - add 'ProcID' + 'notify' - add 'ProcID' + 'devdetails' - add 'ProcID' + 'devdetail' - add 'Name', 'ID', and 'ProcID' + 'pools' - add 'Message' + 'coin' - add 'Network Difficulty' + +Pretty much updated every method returning 'Name' and 'ID' to also return +'ProcID'. This is a number starting with 0 for 'a', 1 for 'b', etc. + +---------- + +API V1.24 (BFGMiner v2.10.3) + +Added API commands: + 'zero' + +Modified API commands: + 'pools' - add 'Best Share' + 'stats' - rename 'Bytes Sent' and 'Bytes Recv' to 'Net Bytes Sent' and + 'Net Bytes Recv' + +---------- + +API V1.23 (BFGMiner v2.10.1) + +Added API commands: + 'pgaset' - with: MMQ opt=clock val=2 to 230 (and a multiple of 2) + +---------- + +API V1.22 (not released) + +Enforced output limitation: + all extra records beyond the output limit of the API (~64k) are ignored and + chopped off at the record boundary before the limit is reached however, JSON + brackets will be correctly closed and the JSON id will be set to 0 (instead + of 1) if any data was truncated. + +Modified API commands: + 'stats' - add 'Times Sent', 'Bytes Sent', 'Times Recv', 'Bytes Recv' + +---------- + +API V1.21 (BFGMiner v2.10.0) + +Modified API commands: + 'summary' - add 'Best Share' + +---------- + +API V1.20b (BFGMiner v2.9.1) + +Support for the X6500 FPGA was added. + +---------- + +API V1.20 (BFGMiner v2.9.0) + +Modified API commands: + 'pools' - add 'Has Stratum', 'Stratum Active', 'Stratum URL' + +---------- + +API V1.19b (BFGMiner v2.8.1) + +Added API commands: + 'pgaidentify|N' (only works for BitForce Singles so far) + +Modified API commands: + Change pool field name back from 'Diff1 Work' to 'Diff1 Shares' + 'devs' - add 'Difficulty Accepted', 'Difficulty Rejected', + 'Last Share Difficulty' to all devices + 'gpu|N' - add 'Difficulty Accepted', 'Difficulty Rejected', + 'Last Share Difficulty' + 'pga|N' - add 'Difficulty Accepted', 'Difficulty Rejected', + 'Last Share Difficulty' + 'notify' - add '*Dev Throttle' (for BitForce Singles) + 'pools' - add 'Difficulty Accepted', 'Difficulty Rejected', + 'Difficulty Stale', 'Last Share Difficulty' + 'stats' - add 'Work Diff', 'Min Diff', 'Max Diff', 'Min Diff Count', + 'Max Diff Count' to the pool stats + 'setconfig|name,value' - add 'Coinbase-Sig' string + +---------- + +API V1.19 (BFGMiner v2.8.0) + +Added API commands: + 'debug' + 'setconfig|name,N' + +Modified API commands: + Change pool field name 'Diff1 Shares' to 'Diff1 Work' + 'devs' - add 'Diff1 Work' to all devices + 'gpu|N' - add 'Diff1 Work' + 'pga|N' - add 'Diff1 Work' + 'pools' - add 'Proxy' + 'config' - add 'Queue', 'Expiry' + +---------- + +API V1.18 (BFGMiner v2.7.4) + +Modified API commands: + 'stats' - add 'Work Had Roll Time', 'Work Can Roll', 'Work Had Expire', + and 'Work Roll Time' to the pool stats + 'config' - include 'ScanTime' + +---------- + +API V1.17b (BFGMiner v2.7.1) + +Modified API commands: + 'summary' - add 'Work Utility' + 'pools' - add 'Diff1 Shares' + +---------- + +API V1.17 (BFGMiner v2.6.5) + +Added API commands: + 'coin' + +---------- + +API V1.16 (BFGMiner v2.6.5) + +Added API commands: + 'failover-only' + +Modified API commands: + 'config' - include failover-only state + +---------- + +API V1.15 (BFGMiner v2.5.2) + +Added API commands: + 'poolpriority' + +---------- + +API V1.14 (BFGMiner v2.5.0) + +Modified API commands: + 'stats' - more Icarus timing stats added + 'notify' - include new device comms error counter + +The internal code for handling data was rewritten (~25% of the code) +Completely backward compatible + +---------- + +API V1.13 (BFGMiner v2.4.4) + +Added API commands: + 'check' + +Support was added to BFGMiner for API access groups with the --api-groups option +It's 100% backward compatible with previous --api-access commands + +---------- + +API V1.12 (BFGMiner v2.4.3) + +Modified API commands: + 'stats' - more pool stats added + +Support for the ModMiner FPGA was added + +---------- + +API V1.11 (BFGMiner v2.4.2) + +Modified API commands: + 'save' no longer requires a filename (use default if not specified) + +'save' incorrectly returned status E (error) on success before. +It now correctly returns S (success) + +---------- + +API V1.10 (BFGMiner v2.4.1) + +Added API commands: + 'stats' + +N.B. the 'stats' command can change at any time so any specific content +present should not be relied upon. +The data content is mainly used for debugging purposes or hidden options +in BFGMiner and can change as development work requires. + +Modified API commands: + 'pools' added "Last Share Time" + +---------- + +API V1.9 (BFGMiner v2.4.0) + +Added API commands: + 'restart' + +Modified API commands: + 'notify' corrected invalid JSON + +---------- + +API V1.8 (BFGMiner v2.3.5) + +Added API commands: + 'devdetails' + +Support for the ZTEX FPGA was added. + +---------- + +API V1.8-pre (BFGMiner v2.3.4) + +Added API commands: + 'devdetail' + +---------- + +API V1.7 (BFGMiner v2.3.4) + +Added API commands: + 'removepool' + +Modified API commands: + 'pools' added "User" + +From API version 1.7 onwards, reply strings in JSON and Text have the +necessary escaping as required to avoid ambiguity. +For JSON the 2 characters '"' and '\' are escaped with a '\' before them. +For Text the 4 characters '|' ',' '=' and '\' are escaped the same way. + +---------- + +API V1.6 (cgminer v2.3.2) + +Added API commands: + 'pga' + 'pgaenable' + 'pgadisable' + 'pgacount' + +Modified API commands: + 'devs' now includes Icarus and BitForce FPGA devices. + 'notify' added "*" to the front of the name of all numeric error fields. + 'config' correct "Log Interval" to use numeric (not text) type for JSON. + +Support for Icarus and BitForce FPGAs was added. + +---------- + +API V1.5 was not released + +---------- + +API V1.4 (Kano's interim release of cgminer v2.3.1) + +Added API commands: + 'notify' + +Modified API commands: + 'config' added "Device Code" and "OS" + +Added "When" to the STATUS reply section of all commands. + +---------- + +API V1.3 (cgminer v2.3.1-2) + +Added API commands: + 'addpool' + +Modified API commands: + 'devs'/'gpu' added "Total MH" for each device + 'summary' added "Total MH" + +---------- + +API V1.2 (cgminer v2.3.0) + +Added API commands: + 'enablepool' + 'disablepool' + 'privileged' + +Modified API commands: + 'config' added "Log Interval" + +Starting with API V1.2, any attempt to access a command that requires +privileged security, from an IP address that does not have privileged +security, will return an "Access denied" Error Status. + +---------- + +API V1.1 (cgminer v2.2.4) + +There were no changes to the API commands in cgminer v2.2.4, +however support was added to cgminer for IP address restrictions +with the --api-allow option. + +---------- + +API V1.1 (cgminer v2.2.2) + +Prior to V1.1, devs/gpu incorrectly reported GPU0 Intensity for all GPUs. + +Modified API commands: + 'devs'/'gpu' added "Last Share Pool" and "Last Share Time" for each device + +---------- + +API V1.0 (cgminer v2.2.0) + +Remove default CPU support. + +Added API commands: + 'config' + 'gpucount' + 'cpucount' + 'switchpool' + 'gpuintensity' + 'gpumem' + 'gpuengine' + 'gpufan' + 'gpuvddc' + 'save' + +---------- + +API V0.7 (cgminer v2.1.0) + +Initial release of the API in the main cgminer git + +Commands: + 'version' + 'devs' + 'pools' + 'summary' + 'gpuenable' + 'gpudisable' + 'gpurestart' + 'gpu' + 'cpu' + 'gpucount' + 'cpucount' + 'quit' + +---------------------------------------- + +miner.php +========= + +miner.php is a PHP based interface to the BFGMiner RPC API +(referred to simply as the API below). + +It can show rig details, summaries and input fields to allow you to change +BFGMiner. +You can also create custom summary pages with it + +It has two levels to the security: +1) BFGMiner can be configured to allow or disallow API access and access level + security for miner.php +2) miner.php can be configured to allow or disallow privileged BFGMiner + access, if BFGMiner is configured to allow privileged access for miner.php + +--------- + +To use miner.php requires a web server with PHP. + +Basics: On Xubuntu 11.04, to install Apache and PHP, the commands are: + sudo apt-get install apache2 + sudo apt-get install php5 + sudo /etc/init.d/apache2 reload + +On Fedora 17: + yum install httpd php + systemctl restart httpd.service + systemctl enable httpd.service --system + +On windows there are a few options. +Try one of these (apparently the first one is easiest - thanks jborkl) + http://www.easyphp.org/ + http://www.apachefriends.org/en/xampp.html + http://www.wampserver.com/en/ + +--------- + +The basic BFGMiner option to enable the API is: + + --api-listen + +or in your bfgminer.conf: + + "api-listen" : true, + +(without the ',' on the end if it is the last item.) + +If the web server is running on the BFGMiner computer, the above +is the only change required to give miner.php basic access to +the BFGMiner API. + +- + +If the web server runs on a different computer to BFGMiner, +you will also need to tell BFGMiner to allow the web server +to access BFGMiner's API and tell miner.php where BFGMiner is. + +Assuming a.b.c.d is the IP address of the web server, you +would add the following to BFGMiner: + + --api-listen --api-allow a.b.c.d + +or in your bfgminer.conf: + + "api-listen" : true, + "api-allow" : "a.b.c.d", + +to tell BFGMiner to give the web server read access to the API. + +You also need to tell miner.php where BFGMiner is. +Assuming BFGMiner is at IP address e.f.g.h, then you would +edit miner.php and change the line: + + $rigs = array('127.0.0.1:4028'); + +to + + $rigs = array('e.f.g.h:4028'); + +See --api-network or --api-allow for more access details +and how to give write access. + +You can however, also tell miner.php to find your mining rigs automatically +on the local subnet. + +Add the following to each BFGMiner: + + --api-mcast + +or in your bfgminer.conf: + + "api-mcast" : true, + +And in miner.php set $mcast = true; + +This will ignore the value of $rigs and overwrite it with the list of zero or +more rigs found on the network in the timeout specified. +A rig will not reply if the API settings would mean it would also ignore an +API request from the web server running miner.php + +--------- + +Once you have a web server with PHP running: + + copy your miner.php to the main web folder + +On Xubuntu 11.04: + /var/www/ + +On Fedora 17: + /var/www/html/ + +On Windows: + Please check your windows Web/PHP documentation. + +Assuming the IP address of the web server is a.b.c.d +Then in your web browser go to: + + http://a.b.c.d/miner.php + +Done :) + +--------- + +The rest of this documentation deals with the more complex +functions of miner.php, using myminer.php, creating custom +summaries and displaying multiple BFGMiner rigs. + +--------- + +If you create a file called myminer.php in the same web folder +where you put miner.php, miner.php will load it when it runs. + +This is useful, to put any changes you need to make to miner.php +instead of changing miner.php. +Thus if you update/get a new miner.php, you won't lose the changes +you have made if you put all your changes in myminer.php +(and haven't changed miner.php at all) + +A simple example myminer.php that defines 2 rigs +(that I will keep referring to further below) is: + + + +Changes in myminer.php supersede what is in miner.php +However, this is only valid for variables in miner.php before the +2 lines where myminer.php is included by miner.php: + + if (file_exists('myminer.php')) + include_once('myminer.php'); + +Every variable in miner.php above those 2 lines, can be changed by +simply defining them in your myminer.php + +So although miner.php originally contains the line: + + $rigs = array('127.0.0.1:4028'); + +if you created the example myminer.php given above, it would actually +change the value of $rigs that is used when miner.php is running. +i.e. you don't have to remove or comment out the $rigs line in miner.php +It will be superseded by myminer.php + +--------- + +The example myminer.php above also shows how to define more that one rig +to be shown my miner.php: + +Each rig string is 2 or 3 values separated by colons ':' +They are simply an IP address or hostname, followed by the +port number (usually 4028) and an optional Name string. + +miner.php displays rig buttons that will show the details of a single +rig when you click on it - the button shows either the rig number, +or the 'Name' string if you provide it. + +PHP arrays contain each string separated by a comma, but no comma after +the last one. + +So an example for 3 rigs would be: + + $rigs = array('192.168.0.100:4028:A', '192.168.0.102:4028:B', + '192.168.0.110:4028:C'); + +Of course each of the rigs listed would also have to have the API +running and be set to allow the web server to access the API - as +covered earlier in this document. + +--------- + +So basically, any variable explained below can be put in myminer.php if you want +to set it to something different to its default value and did not want to change +miner.php itself every time you update it. + +Below is a list of the variables that can be changed and an explanation of each. + +--------- + +Default: + $dfmt = 'H:i:s j-M-Y \U\T\CP'; + +Define the date format used to print full length dates. +If you get the string 'UTCP' on the end of your dates shown, that +means you are using an older version of PHP and you can instead use: + $dfmt = 'H:i:s j-M-Y \U\T\CO'; + +The PHP documentation on the date format is here: + http://us.php.net/manual/en/function.date.php + +--------- + +Default: + $title = 'Mine'; + +Web page title. +If you know PHP you can of course use code to define it e.g. + $title = 'My Rig at: '.date($dfmt); + +Which would set the web page title to something like: + My Rig at: 10:34:00 22-Aug-2012 UTC+10:00 + +--------- + +Default: + $readonly = false; + +Set $readonly to true to force miner.php to be readonly. +This means it won't allow you to change BFGMiner even if the RPC API +options allow it to. + +If you set $readonly to false then it will check BFGMiner 'privileged' +and will show input fields and buttons on the single rig page, +allowing you to change devices, pools and even quit or restart +BFGMiner. + +However, if the 'privileged' test fails, the code will set $readonly to +true. + +--------- + +Default: + $userlist = null; + +Define password checking and default access null means there is no password +checking. + +$userlist is an array of 3 arrays, e.g. +$userlist = array('sys' => array('boss' => 'bpass'), + 'usr' => array('user' => 'upass', 'pleb' => 'ppass'), + 'def' => array('Pools')); + +'sys' is an array of system users and passwords (full access). +'usr' is an array of user level users and passwords (readonly access). +'def' is an array of custompages that anyone not logged in can view. + +Any of the 3 can be null, meaning there are none of that item. + +All validated 'usr' users are given $readonly = true; access. +All validated 'sys' users are given the $readonly access you defined. + +If 'def' has one or more values, and allowcustompages is true, then anyone +without a password can see the list of custompage buttons given in 'def' and +will see the first one when they go to the web page, with a login button at the +top right. + +From the login page, if you login with no username or password, it will show +the first 'def' custompage (if there are any). + +If you are logged in, it will show a logout button at the top right. + +--------- + +Default: + $notify = true; + +Set $notify to false to NOT attempt to display the notify command table of data + +Set $notify to true to attempt to display the notify command on the single rig +page. +If your older version of BFGMiner returns an 'Invalid command' because it +doesn't have notify - it just shows the error status table. + +--------- + +Default: + $checklastshare = true; + +Set $checklastshare to true to do the following checks: +If a device's last share is 12x expected ago then display as an error. +If a device's last share is 8x expected ago then display as a warning. +If either of the above is true, also display the whole line highlighted +This assumes shares are 1 difficulty shares. + +Set $checklastshare to false to not do the above checks. + +'expected' is calculated from the device Mh/s value. +So for example, a device that hashes at 380Mh/s should (on average) find a +share every 11.3s. +If the last share was found more than 11.3 x 12 seconds (135.6s) ago, it is +considered an error and highlighted. +If the last share was found more than 11.3 x 8 seconds (90.4s) ago, it is +considered a warning and highlighted. + +The default highlighting is very subtle, so change it if you want it to be more +obvious. + +--------- + +Default: + $poolinputs = false; + +Set $poolinputs to true to show the input fields for adding a pool and changing +the pool priorities on a single rig page. +However, if $readonly is true, it will not display them. + +--------- + +Default: + $rigs = array('127.0.0.1:4028'); + +Set $rigs to an array of your BFGMiner rigs that are running format: 'IP:Port' + or 'Host:Port' or 'Host:Port:Name'. +If you only have one rig, it will just show the detail of that rig. +If you have more than one rig it will show a summary of all the rigs with + buttons to show the details of each rig - the button contents will be 'Name' + rather than rig number, if you specify 'Name'. +e.g. $rigs = array('127.0.0.1:4028','myrig.com:4028:Sugoi'); + +--------- + +Default: + $mcast = false; + +Set $mcast to true to look for your rigs and ignore $rigs. + +--------- + +Default: + $mcastexpect = 0; + +The minimum number of rigs expected to be found when $mcast is true. +If fewer are found, an error will be included at the top of the page. + +--------- + +Default: + $mcastaddr = '224.0.0.75'; + +API Multicast address all miners are listening on. + +--------- + +Default: + $mcastport = 4028; + +API Multicast UDP port all miners are listening on. + +--------- + +Default: + $mcastcode = 'FTW'; + +The code all miners expect in the Multicast message sent. +The message sent is "cgm-code-listport". +Don't use the '-' character if you change it. + +--------- + +Default: + $mcastlistport = 4027; + +UDP port number that is added to the broadcast message sent +that specifies to the miners the port to reply on. + +--------- + +Default: + $mcasttimeout = 1.5; + +Set $mcasttimeout to the number of seconds (floating point) +to wait for replies to the Multicast message. +N.B. the accuracy of the timing used to wait for the replies is +~0.1s so there's no point making it more than one decimal place. + +--------- + +Default: + $mcastretries = 0; + +Set $mcastretries to the number of times to retry the multicast. + +If $mcastexpect is 0, this is simply the number of extra times +that it will send the multicast request. +N.B. BFGMiner doesn't listen for multicast requests for 1000ms after +each one it hears. + +If $mcastexpect is > 0, it will stop looking for replies once it +has found at least $mcastexpect rigs, but it only checks this rig +limit each time it reaches the $mcasttimeout limit, thus it can find +more than $mcastexpect rigs if more exist. +It will send the multicast message up to $mcastretries extra times or +until it has found at least $mcastexpect rigs. +When using $mcastretries, it is however possible for it to sometimes +ignore some rigs on the network if $mcastexpect is less than the +number of rigs on the network and some rigs are too slow to reply. + +--------- + +Default: + $allowgen = false; + +Set $allowgen to true to allow customsummarypages to use 'gen', +false means ignore any 'gen' options. +This is disabled by default due to the possible security risk +of using it, please see the end of this document for an explanation. + +--------- + +Default: + $rigipsecurity = true; + +Set $rigipsecurity to false to show the IP/Port of the rig in the socket error + messages and also show the full socket message. + +--------- + +Default: + $rigtotals = true; + $forcerigtotals = false; + +Set $rigtotals to true to display totals on the single rig page, 'false' means + no totals (and ignores $forcerigtotals). + +If $rigtotals is true, all data is also right aligned. +With false, it's as before, left aligned. + +This option is just here to allow people to set it to false if they prefer the + old non-total display when viewing a single rig. + +Also, if there is only one line shown in any section, then no total will be + shown (to save screen space). +You can force it to always show rig totals on the single rig page, even if + there is only one line, by setting $forcerigtotals = true; + +--------- + +Default: + $socksndtimeoutsec = 10; + $sockrcvtimeoutsec = 40; + +The numbers are integer seconds. + +The defaults should be OK for most cases. +However, the longer SND is, the longer you have to wait while PHP hangs if the +target BFGMiner isn't running or listening. + +RCV should only ever be relevant if BFGMiner has hung but the API thread is +still running, RCV would normally be >= SND. + +Feel free to increase SND if your network is very slow or decrease RCV if that +happens often to you. + +Also, on some windows PHP, apparently the $usec is ignored (so usec can't be +specified). + +--------- + +Default: + $hidefields = array(); + +List of fields NOT to be displayed. +You can use this to hide data you don't want to see or don't want shown on a +public web page. +The list of sections are: + SUMMARY, POOL, PGA, GPU, NOTIFY, CONFIG, DEVDETAILS, DEVS +See the web page for the list of field names (the table headers). +It is an array of 'SECTION.Field Name' => 1 + +This example would hide the slightly more sensitive pool information: +Pool URL and pool username: + $hidefields = array('POOL.URL' => 1, 'POOL.User' => 1); + +If you just want to hide the pool username: + $hidefields = array('POOL.User' => 1); + +--------- + +Default: + $ignorerefresh = false; + $changerefresh = true; + $autorefresh = 0; + +Auto-refresh of the page (in seconds) - integers only. + +$ignorerefresh = true/false always ignore refresh parameters. +$changerefresh = true/false show buttons to change the value. +$autorefresh = default value, 0 means don't auto-refresh. + +--------- + +Default: + $placebuttons = 'top'; + +Where to place the Refresh, Summary, Custom Pages, Quit, etc. buttons. + +Valid values are: 'top' 'bot' 'both' + Anything else means don't show them. (case sensitive) + +--------- + +Default: + $miner_font_family = 'verdana,arial,sans'; + $miner_font_size = '13pt'; + +Change these to set the font and font size used on the web page. + +--------- + +Default: + $colouroverride = array(); + +Use this to change the web page colour scheme. + +See $colourtable in miner.php for the list of possible names to change. + +Simply put in $colouroverride, just the colours you wish to change. + +e.g. to change the colour of the header font and background +you could do the following: + + $colouroverride = array( + 'td.h color' => 'green', + 'td.h background' => 'blue' + ); + +--------- + +Default: + $allowcustompages = true; + +Should we allow custom pages? +(or just completely ignore them and don't display the buttons.) + +--------- + +OK this part is more complex: Custom Summary Pages. + +A custom summary page in an array of 'section' => array('FieldA','FieldB'...) + +The section defines what data you want in the summary table and the Fields +define what data you want shown from that section. + +Standard sections are: + SUMMARY, POOL, PGA, GPU, NOTIFY, CONFIG, DEVDETAILS, DEVS, STATS, COIN + +Fields are the names as shown on the headers on the normal pages. + +Fields can be 'name=new name' to display 'name' with a different heading +'new name'. + +There are also now joined sections: + SUMMARY+POOL, SUMMARY+DEVS, SUMMARY+CONFIG, DEVS+NOTIFY, DEVS+DEVDETAILS + SUMMARY+COIN + +These sections are an SQL join of the two sections and the fields in them +are named section.field where 'section.' is the section the field comes from +See the example further down. + +Also note: +- empty tables are not shown. +- empty columns (e.g. an unknown field) are not shown. +- missing field data shows as blank. +- the field name '*' matches all fields except in joined sections + (useful for STATS and COIN). + +There are 2 hard coded sections: + DATE - displays a date table like at the start of 'Summary'. + RIGS - displays a rig table like at the start of 'Summary'. + +Each custom summary requires a second array, that can be empty, listing fields +to be totalled for each section. +If there is no matching total data, no total will show. + +--------- + +Looking at the Mobile example: + + $mobilepage = array( + 'DATE' => null, + 'RIGS' => null, + 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', + Accepted', 'Rejected=Rej', 'Utility'), + 'DEVS+NOTIFY' => array('DEVS.Name=Name', 'DEVS.ID=ID', 'DEVS.ProcID=Proc', + 'DEVS.Status=Status', + 'DEVS.Temperature=Temp', 'DEVS.MHS av=MHS av', + 'DEVS.Accepted=Accept', 'DEVS.Rejected=Rej', + 'DEVS.Utility=Utility', 'NOTIFY.Last Not Well=Not Well'), + 'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected=Rej', + 'Last Share Time')); + + $mobilesum = array( + 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', 'Rejected', + 'Utility'), + 'DEVS+NOTIFY' => array('DEVS.MHS av', 'DEVS.Accepted', 'DEVS.Rejected', + 'DEVS.Utility'), + 'POOL' => array('Accepted', 'Rejected')); + + $customsummarypages = array('Mobile' => array($mobilepage, $mobilesum)); + +This will show 5 tables (according to $mobilepage). +Each table will have the chosen details for all the rigs specified in $rigs + + DATE + A single box with the web server's current date and time. + + RIGS + A table of the rigs: description, time, versions etc. + + SUMMARY + + This will use the API 'summary' command and show the selected fields: + Elapsed, MHS av, Found Blocks, Accepted, Rejected and Utility + However, 'Rejected=Rej' means that the header displayed for the 'Rejected' + field will be 'Rej', instead of 'Rejected' (to save space). + Same for 'Found Blocks=Blks' - to save space. + + DEVS+NOTIFY + + This will list each of the devices on each rig and display the list of + fields as shown. + It will also include the 'Last Not Well' field from the 'notify' command + so you know when the device was last not well. + + You will notice that you need to rename each field e.g. 'DEVS.Name=Name' + since each field name in the join between DEVS and NOTIFY is actually + section.fieldname, not just fieldname. + + The join code automatically adds 2 fields to each GPU device: 'Name', 'ID', + and 'ProcID'. They don't exist in the API 'devs' output but we can correctly + calculate them from the GPU device data. These two fields are used to join + DEVS to NOTIFY: i.e. find the NOTIFY record that has the same Name/ID/ProcID + as the DEVS record and join them. + + POOL + + This will use the API 'pools' command and show the selected fields: + POOL, Status, Accepted, Rejected, Last Share Time + Again, I renamed the 'Rejected' field using 'Rejected=Rej', to save space. + +$mobilesum lists the sections and fields that should have a total. +You can't define them for 'DATE' or 'RIGS' since they are hard coded tables. +The example given: + + SUMMARY + Show a total at the bottom of the columns for: + MHS av, Found Blocks, Accepted, Rejected, Utility + + Firstly note that you use the original name i.e. for 'Rejected=Rej' + you use 'Rejected', not 'Rej' and not 'Rejected=Rej'. + + Secondly note that it simply adds up the fields. + If you ask for a total of a string field you will get the numerical + sum of the string data. + + DEVS+NOTIFY + + Simply note in this join example that you must use the original field + names which are section.fieldname, not just fieldname. + + POOL + Show a total at the bottom of the columns for: + Accepted and Rejected + + Again remember to use the original field name 'Rejected'. + +--------- + +With BFGMiner 2.10.1 and later, miner.php includes an extension to the custom +pages that allows you to apply SQL style commands to the data: where, group, +and having +BFGMiner 3.4.0 also includes another option 'gen'. + +As an example, miner.php includes a more complex custom page called 'Pools' +which includes the extension: + +$poolsext = array( + 'POOL+STATS' => array( + 'where' => null, + 'group' => array('POOL.URL', 'POOL.Has Stratum', + 'POOL.Stratum Active'), + 'calc' => array('STATS.Bytes Sent' => 'sum', + 'STATS.Bytes Recv' => 'sum'), + 'gen' => array('AvShr', 'POOL.Difficulty Accepted/max(POOL.Accepted,1)), + 'having' => array(array('STATS.Bytes Recv', '>', 0))) +); + +This allows you to group records together from one or more rigs. +In the example, you'll get each Pool (with the same URL+Stratum info) listed +once for all rigs and a sum of each of the fields listed in 'calc'. + + +'where' and 'having' are an array of fields and restrictions to apply. + +In the above example, it will only display the rows where it contains the +'STATS.Bytes Recv' field with a value greater than zero. +If the row doesn't have the field, it will always be included. +All restrictions must be true in order for the row to be included. +Any restiction that is invalid or unknown is true. +An empty array, or null, means there are no restrictions. + +A restriction is formatted as: array('Field', 'restriction', 'value') +Field is the simple field name as normally displayed, or SECTION.Field if it is +a joined section (as in this case 'POOL+STATS'). +The list of restrictions are: +'set' - true if the row contains the 'Field' ('value' is not required or used) +'=', '<', '<=', '>', '>' - a numerical comparison. +'eq', 'lt', 'le', 'gt', 'ge' - a case insensitive string comparison. + +You can have multiple restrictions on a 'Field' - but all must be true to +include the row containing the 'Field'. +e.g. a number range between 0 and 10 would be: +array('STATS.Bytes Recv', '>', 0), array('STATS.Bytes Recv', '<', 10) + +The difference between 'where' and 'having' is that 'where' is applied to the +data before grouping it and 'having' is applied to the data after grouping it +- otherwise they work the same. + + +'group' lists the fields to group over and 'calc' lists the function to apply +to other fields that are not part of 'group'. + +You can only see fields listed in 'group' and 'calc'. + +A 'calc' is formatted as: 'Field' => 'function' +The current list of operations available for 'calc' are: +'sum', 'avg', 'min', 'max', 'lo', 'hi', 'count', 'any' +The first 4 are as expected - the numerical sum, average, minimum or maximum. +'lo' is the first string of the list, sorted ignoring case. +'hi' is the last string of the list, sorted ignoring case. +'count' is the number of rows in the section specified in the calc e.g. + ('DEVS.Name' => 'count') would be the number of DEVS selected in the 'where' + of course any valid 'DEVS.Xyz' would give the same 'count' value. +'any' is effectively random: the field value in the 1st row of the grouped data. +An unrecognised 'function' uses 'any'. + +A 'gen' allows you to generate new fields from any php valid function of any +of the other fields. + e.g. 'gen' => array('AvShr', 'POOL.Difficulty Accepted/max(POOL.Accepted,1)), +will generate a new field called GEN.AvShr that is the function shown, which +in this case is the average difficulty of each share submitted. + +THERE IS A SECURITY RISK WITH HOW GEN WORKS! +It simply replaces all the variables with their values and then requests PHP +to execute the formula - thus if a field value returned from a BFGMiner API +request contained PHP code, it could be executed by your web server. +Of course BFGMiner doesn't do this, but if you do not control the BFGMiner that +returns the data in the API calls, someone could modify BFGMiner to return a +PHP string in a field you use in 'gen'. +Thus use 'gen' at your own risk. +If someone feels the urge to write a mathematical interpreter in PHP to get +around this risk, feel free to write one and submit it to the API author for +consideration. diff --git a/bfgminer3.9/share/doc/bfgminer/README.scrypt b/bfgminer3.9/share/doc/bfgminer/README.scrypt new file mode 100644 index 0000000..6a5a433 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/README.scrypt @@ -0,0 +1,229 @@ +If you wish to donate to the author of scrypt support, Con Kolivas, for his past +work (he no longer maintains this), please send your donations to: +15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ + +--- + +Scrypt mining for GPU is completely different to sha256 used for bitcoin +mining. It has very different requirements to bitcoin mining and is a +lot more complicated to get working well. Note that it is a ram dependent +workload, and requires you to have enough system ram as well as fast enough +GPU ram. If you have less system ram than your GPU has, it may not be possible +to mine at any reasonable rate. + +There are 5 main parameters to tuning scrypt, all of which are optional for +further fine tuning. When you start scrypt mining with the --scrypt option, +BFGMiner will fail IN RANDOM WAYS. They are all due to parameters being outside +what the GPU can cope with. + +NOTE that if it does not fail at startup, the presence of hardware errors (HW) +are a sure sign that you have set the parameters too high. + + +DRIVERS AND OPENCL SDK + +The choice of driver version for your GPU is critical, as some are known to +break scrypt mining entirely while others give poor hashrates. As for the +OpenCL SDK installed, for AMD it must be version 2.6 or later. + + +Step 1 on Linux: +export GPU_MAX_ALLOC_PERCENT=100 +If you do not do this, you may find it impossible to scrypt mine. You may find +a value of 40 is enough and increasing this further has little effect. + +export GPU_USE_SYNC_OBJECTS=1 +may help CPU usage a little as well. + +On windows the same commands can be passed via a batch file if the following +lines are in the .bat before starting BFGMiner: +setx GPU_MAX_ALLOC_PERCENT 100 +setx GPU_USE_SYNC_OBJECTS 1 + +--intensity XX (-I XX) + +Just like in Bitcoin mining, scrypt mining takes an intensity, however the +scale goes from 0 to 20 to mimic the "Aggression" used in mtrlt's reaper. The +reason this is crucial is that too high an intensity can actually be +disastrous with scrypt because it CAN run out of ram. High intensities +start writing over the same ram and it is highly dependent on the GPU, but they +can start actually DECREASING your hashrate, or even worse, start producing +garbage with HW errors skyrocketing. Note that if you do NOT specify an +intensity, BFGMiner uses dynamic mode which is designed to minimise the harm +to a running desktop and performance WILL be poor. The lower limit to intensity +with scrypt is usually 8 and BFGMiner will prevent it going too low. +SUMMARY: Setting this for reasonable hashrates is mandatory. + +--shaders XXX + +is a new option where you tell BFGMiner how many shaders your GPU has. This +helps BFGMiner try to choose some meaningful baseline parameters. Use this table +below to determine how many shaders your GPU has, and note that there are some +variants of these cards, and Nvidia shaders are much much lower and virtually +pointless trying to mine on. If this is not set, BFGMiner will query the +device for how much memory it supports and will try to set a value based on +that instead. +SUMMARY: This will get you started but fine tuning for optimal performance is +required. + +GPU Shaders +7750 512 +7770 640 +7850 1024 +7870 1280 +7950 1792 +7970 2048 + +6850 960 +6870 1120 +6950 1408 +6970 1536 +6990 (6970x2) + +6570 480 +6670 480 +6790 800 + +6450 160 + +5670 400 +5750 720 +5770 800 +5830 1120 +5850 1440 +5870 1600 +5970 (5870x2) + +These are only used as a rough guide for BFGMiner, and it is rare that this is +all you will need to set. + + +Optional parameters to tune: +-g, --thread-concurrency, --lookup-gap + +--thread-concurrency: +This tunes the optimal size of work that scrypt can do. It is internally tuned +by BFGMiner to be the highest reasonable multiple of shaders that it can +allocate on your GPU. Ideally it should be a multiple of your shader count. +vliw5 architecture (R5XXX) would be best at 5x shaders, while VLIW4 (R6xxx and +R7xxx) are best at 4x. Setting thread concurrency overrides anything you put +into --shaders and is ultimately a BETTER way to tune performance. +SUMMARY: Spend lots of time finding the highest value that your device likes +and increases hashrate. + +-g: +Once you have found the optimal shaders and intensity, you can start increasing +the -g value till BFGMiner fails to start. This is really only of value if you +want to run low intensities as you will be unable to run more than 1. +SUMMARY: Don't touch this. + +--lookup-gap +This tunes a compromise between ram usage and performance. Performance peaks +at a gap of 2, but increasing the gap can save you some GPU ram, but almost +always at the cost of significant loss of hashrate. Setting lookup gap +overrides the default of 2, but BFGMiner will use the --shaders value to choose +a thread-concurrency if you haven't chosen one. +SUMMARY: Don't touch this. + + +Related parameters: +--worksize XX (-w XX) +Has a minor effect, should be a multiple of 64 up to 256 maximum. +SUMMARY: Worth playing with once everything else has been tried but will +probably do nothing. + +--vectors XX (-v XX) +Vectors are NOT used by the scrypt mining kernel. +SUMMARY: Does nothing. + + +Overclocking for scrypt mining: +First of all, do not underclock your memory initially. Scrypt mining requires +memory speed and on most, but not all, GPUs, lowering memory speed lowers +mining performance. + +Second, absolute engine clock speeds do NOT correlate with hashrate. The ratio +of engine clock speed to memory matters, so if you set your memory to the +default value, and then start overclocking as you are running it, you should +find a sweet spot where the hashrate peaks and then it might actually drop if +you increase the engine clock speed further. + +Third, the combination of motherboard, CPU and system ram ALSO makes a +difference, so values that work for a GPU on one system may not work for the +same GPU on a different system. A decent amount of system ram is actually +required for scrypt mining, and 4GB is suggested. + +Finally, the power consumption while mining at high engine clocks, very high +memory clocks can be far in excess of what you might imagine. +For example, a 7970 running with the following settings: +--thread-concurrency 22392 --gpu-engine 1135 --gpu-memclock 1890 +was using 305W! + +--- +TUNING AN AMD RADEON 7970 +Example tuning a 7970 for Scrypt mining: + +On Linux run this command: +export GPU_MAX_ALLOC_PERCENT=100 +or on Windows this: +setx GPU_MAX_ALLOC_PERCENT 100 +in the same console/bash/dos prompt/bat file/whatever you want to call it, +before running BFGMiner. + +First, find the highest thread concurrency that you can start it at. They should +all start at 8192 but some will go up to 3 times that. Don't go too high on the +intensity while testing and don't change gpu threads. If you cannot go above +8192, don't fret as you can still get a high hashrate. + +Delete any .bin files so you're starting from scratch and see what bins get +generated. + +First try without any thread concurrency or even shaders, as BFGMiner will try to +find an optimal value: +bfgminer -I 13 + +If that starts mining, see what bin was generated, it is likely the largest +meaningful TC you can set. +Starting it on mine I get: +scrypt130302Tahitiglg2tc22392w64l8.bin + +Note that tc22392 tells you what thread concurrency it was. It should start +without TC parameters, but you never know. So if it doesn't, start with +--thread-concurrency 8192 and add 2048 to it at a time till you find the highest +value it will start successfully at. + +If you wish to get a little extra from your hardware, you may also try +overclocking. Do note that this will damage your GPUs and void your warranty, +so unless you are willing to take that risk, skip the --gpu-engine and +--gpu-memclock sections! + +Then start overclocking the eyeballs off your memory, as 7970s are exquisitely +sensitive to memory speed and amazingly overclockable but please make sure it +keeps adequately cooled with --auto-fan! Do it while it's running from the GPU +menu. Go up by 25 at a time every 30 seconds or so until your GPU crashes. Then +reboot and start it 25 lower as a rough start. One example runs stable at 1900 +memory without overvolting. + +Then once you find the maximum memory clock speed, you need to find the sweet +spot engine clock speed that matches it. It's a fine line where one more MHz +will make the hashrate drop by 20%. It's somewhere in the .57 - 0.6 ratio range. +Start your engine clock speed at half your memory clock speed and then increase +it by 5 at a time. The hashrate should climb a little each rise in engine speed +and then suddenly drop above a certain value. Decrease it by 1 then until you +find it climbs dramatically. If your engine clock speed cannot get that high +without crashing the GPU, you will have to use a lower memclock. + +Then, and only then, bother trying to increase intensity further. + +My final settings were: +--gpu-engine 1141 --gpu-memclock 1875 -I 20 +for a hashrate of 745kH. + +Note I did not bother setting a thread concurrency. Once you have the magic +endpoint, look at what tc was chosen by the bin file generated and then hard +code that in next time (eg --thread-concurrency 22392) as slight changes in +thread concurrency will happen every time if you don't specify one, and the tc +to clock ratios are critical! + +Your numbers will be your numbers depending on your hardware combination and OS, +so don't expect to get exactly the same results! diff --git a/bfgminer3.9/share/doc/bfgminer/example.conf b/bfgminer3.9/share/doc/bfgminer/example.conf new file mode 100644 index 0000000..069c025 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/example.conf @@ -0,0 +1,48 @@ +{ +"pools" : [ + { + "url" : "http://url1:8332", + "user" : "user1", + "pass" : "pass1" + }, + { + "url" : "http://url2:8344", + "pool-proxy" : "socks5://127.0.0.1:1080", + "user" : "user2", + "pass" : "pass2" + }, + { + "url" : "http://url3:8332", + "user" : "user3", + "pass" : "pass3" + } +], + +"intensity" : "d,9,9,9", +"gpu-engine" : "0-985,0-950,0-960,0-1000", +"gpu-fan" : "0-85,0-85,0-85,0-85", +"gpu-memclock" : "860,825,835,875", +"gpu-powertune" : "20,20,20,20", +"temp-cutoff" : "95,95,95,95", +"temp-overheat" : "85,85,85,85", +"temp-target" : "75,75,75,75", + +"auto-fan" : true, +"auto-gpu" : true, +"expiry" : 120, +"failover-only" : true, +"gpu-threads" : 2, +"log" : 5, +"queue" : 1, +"scan-time" : 60, +"temp-hysteresis" : 3, + +"scan-serial" : [ + "/dev/ttyUSB0", + "/dev/ttyUSB1", + "/dev/ttyUSB2", + "/dev/ttyUSB3" +], + +"kernel-path" : "/usr/local/bin" +} diff --git a/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.c b/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.c new file mode 100644 index 0000000..a92c58d --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.c @@ -0,0 +1,328 @@ +/* + * Copyright 2011 Kano + * Copyright 2013 Luke Dashjr + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 3 of the License, or (at your option) + * any later version. See COPYING for more details. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "compat.h" + +#ifndef WIN32 + #include + #include + #include + #include + #include + + #define SOCKETTYPE int + #define SOCKETFAIL(a) ((a) < 0) + #define INVSOCK -1 + #define CLOSESOCKET close + + #define SOCKETINIT do{}while(0) + + #define SOCKERRMSG strerror(errno) +#else + #include + + #define SOCKETTYPE SOCKET + #define SOCKETFAIL(a) ((a) == SOCKET_ERROR) + #define INVSOCK INVALID_SOCKET + #define CLOSESOCKET closesocket + + static char WSAbuf[1024]; + + struct WSAERRORS { + int id; + char *code; + } WSAErrors[] = { + { 0, "No error" }, + { WSAEINTR, "Interrupted system call" }, + { WSAEBADF, "Bad file number" }, + { WSAEACCES, "Permission denied" }, + { WSAEFAULT, "Bad address" }, + { WSAEINVAL, "Invalid argument" }, + { WSAEMFILE, "Too many open sockets" }, + { WSAEWOULDBLOCK, "Operation would block" }, + { WSAEINPROGRESS, "Operation now in progress" }, + { WSAEALREADY, "Operation already in progress" }, + { WSAENOTSOCK, "Socket operation on non-socket" }, + { WSAEDESTADDRREQ, "Destination address required" }, + { WSAEMSGSIZE, "Message too long" }, + { WSAEPROTOTYPE, "Protocol wrong type for socket" }, + { WSAENOPROTOOPT, "Bad protocol option" }, + { WSAEPROTONOSUPPORT, "Protocol not supported" }, + { WSAESOCKTNOSUPPORT, "Socket type not supported" }, + { WSAEOPNOTSUPP, "Operation not supported on socket" }, + { WSAEPFNOSUPPORT, "Protocol family not supported" }, + { WSAEAFNOSUPPORT, "Address family not supported" }, + { WSAEADDRINUSE, "Address already in use" }, + { WSAEADDRNOTAVAIL, "Can't assign requested address" }, + { WSAENETDOWN, "Network is down" }, + { WSAENETUNREACH, "Network is unreachable" }, + { WSAENETRESET, "Net connection reset" }, + { WSAECONNABORTED, "Software caused connection abort" }, + { WSAECONNRESET, "Connection reset by peer" }, + { WSAENOBUFS, "No buffer space available" }, + { WSAEISCONN, "Socket is already connected" }, + { WSAENOTCONN, "Socket is not connected" }, + { WSAESHUTDOWN, "Can't send after socket shutdown" }, + { WSAETOOMANYREFS, "Too many references, can't splice" }, + { WSAETIMEDOUT, "Connection timed out" }, + { WSAECONNREFUSED, "Connection refused" }, + { WSAELOOP, "Too many levels of symbolic links" }, + { WSAENAMETOOLONG, "File name too long" }, + { WSAEHOSTDOWN, "Host is down" }, + { WSAEHOSTUNREACH, "No route to host" }, + { WSAENOTEMPTY, "Directory not empty" }, + { WSAEPROCLIM, "Too many processes" }, + { WSAEUSERS, "Too many users" }, + { WSAEDQUOT, "Disc quota exceeded" }, + { WSAESTALE, "Stale NFS file handle" }, + { WSAEREMOTE, "Too many levels of remote in path" }, + { WSASYSNOTREADY, "Network system is unavailable" }, + { WSAVERNOTSUPPORTED, "Winsock version out of range" }, + { WSANOTINITIALISED, "WSAStartup not yet called" }, + { WSAEDISCON, "Graceful shutdown in progress" }, + { WSAHOST_NOT_FOUND, "Host not found" }, + { WSANO_DATA, "No host data of that type was found" }, + { -1, "Unknown error code" } + }; + + static char *WSAErrorMsg() + { + int i; + int id = WSAGetLastError(); + + /* Assume none of them are actually -1 */ + for (i = 0; WSAErrors[i].id != -1; i++) + if (WSAErrors[i].id == id) + break; + + sprintf(WSAbuf, "Socket Error: (%d) %s", id, WSAErrors[i].code); + + return &(WSAbuf[0]); + } + + #define SOCKERRMSG WSAErrorMsg() + + static WSADATA WSA_Data; + + #define SOCKETINIT do { \ + int wsa; \ + if ( (wsa = WSAStartup(0x0202, &WSA_Data)) ) { \ + printf("Socket startup failed: %d\n", wsa); \ + return 1; \ + } \ + } while (0) + + #ifndef SHUT_RDWR + #define SHUT_RDWR SD_BOTH + #endif +#endif + +#define RECVSIZE 65500 + +static const char SEPARATOR = '|'; +static const char COMMA = ','; +static const char EQ = '='; +static int ONLY; + +void display(char *buf) +{ + char *nextobj, *item, *nextitem, *eq; + int itemcount; + + while (buf != NULL) { + nextobj = strchr(buf, SEPARATOR); + if (nextobj != NULL) + *(nextobj++) = '\0'; + + if (*buf) { + item = buf; + itemcount = 0; + while (item != NULL) { + nextitem = strchr(item, COMMA); + if (nextitem != NULL) + *(nextitem++) = '\0'; + + if (*item) { + eq = strchr(item, EQ); + if (eq != NULL) + *(eq++) = '\0'; + + if (itemcount == 0) + printf("[%s%s] =>\n(\n", item, (eq != NULL && isdigit(*eq)) ? eq : ""); + + if (eq != NULL) + printf(" [%s] => %s\n", item, eq); + else + printf(" [%d] => %s\n", itemcount, item); + } + + item = nextitem; + itemcount++; + } + if (itemcount > 0) + puts(")"); + } + + buf = nextobj; + } +} + +int callapi(char *command, char *host, short int port) +{ + size_t bufsz = RECVSIZE; + char *buf = malloc(bufsz+1); + struct hostent *ip; + struct sockaddr_in serv; + SOCKETTYPE sock; + int ret = 0; + int n, p; + + assert(buf); + SOCKETINIT; + + ip = gethostbyname(host); + if (!ip) + { + printf("Failed to resolve host %s\n", host); + return 1; + } + + sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock == INVSOCK) { + printf("Socket initialisation failed: %s\n", SOCKERRMSG); + return 1; + } + + memset(&serv, 0, sizeof(serv)); + serv.sin_family = AF_INET; + serv.sin_addr = *((struct in_addr *)ip->h_addr); + serv.sin_port = htons(port); + + if (SOCKETFAIL(connect(sock, (struct sockaddr *)&serv, sizeof(struct sockaddr)))) { + printf("Socket connect failed: %s\n", SOCKERRMSG); + return 1; + } + + n = send(sock, command, strlen(command), 0); + if (SOCKETFAIL(n)) { + printf("Send failed: %s\n", SOCKERRMSG); + ret = 1; + } + else { + p = 0; + buf[0] = '\0'; + while (true) + { + if (bufsz < RECVSIZE + p) + { + bufsz *= 2; + buf = realloc(buf, bufsz); + assert(buf); + } + + n = recv(sock, &buf[p], RECVSIZE, 0); + + if (SOCKETFAIL(n)) { + printf("Recv failed: %s\n", SOCKERRMSG); + ret = 1; + break; + } + + if (n == 0) + break; + + p += n; + buf[p] = '\0'; + } + + if (!ONLY) + printf("Reply was '%s'\n", buf); + else + printf("%s\n", buf); + + if (!ONLY) + display(buf); + } + + CLOSESOCKET(sock); + + return ret; +} + +static char *trim(char *str) +{ + char *ptr; + + while (isspace(*str)) + str++; + + ptr = strchr(str, '\0'); + while (ptr-- > str) { + if (isspace(*ptr)) + *ptr = '\0'; + } + + return str; +} + +int main(int argc, char *argv[]) +{ + char *command = "summary"; + char *host = "127.0.0.1"; + short int port = 4028; + char *ptr; + int i = 1; + + if (argc > 1) + if (strcmp(argv[1], "-?") == 0 + || strcmp(argv[1], "-h") == 0 + || strcmp(argv[1], "--help") == 0) { + fprintf(stderr, "Usage: %s [command [ip/host [port]]]\n", argv[0]); + return 1; + } + + if (argc > 1) + if (strcmp(argv[1], "-o") == 0) { + ONLY = 1; + i = 2; + } + + if (argc > i) { + ptr = trim(argv[i++]); + if (strlen(ptr) > 0) + command = ptr; + } + + if (argc > i) { + ptr = trim(argv[i++]); + if (strlen(ptr) > 0) + host = ptr; + } + + if (argc > i) { + ptr = trim(argv[i]); + if (strlen(ptr) > 0) + port = atoi(ptr); + } + + return callapi(command, host, port); +} diff --git a/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.php b/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.php new file mode 100644 index 0000000..558074c --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.php @@ -0,0 +1,118 @@ + 0) + { + $items = explode(',', $obj); + $item = $items[0]; + $id = explode('=', $items[0], 2); + if (count($id) == 1 or !ctype_digit($id[1])) + $name = $id[0]; + else + $name = $id[0].$id[1]; + + if (strlen($name) == 0) + $name = 'null'; + + if (isset($data[$name])) + { + $num = 1; + while (isset($data[$name.$num])) + $num++; + $name .= $num; + } + + $counter = 0; + foreach ($items as $item) + { + $id = explode('=', $item, 2); + if (count($id) == 2) + $data[$name][$id[0]] = $id[1]; + else + $data[$name][$counter] = $id[0]; + + $counter++; + } + } + } + + return $data; + } + + return null; +} +# +if (isset($argv) and count($argv) > 1) + $r = request($argv[1]); +else + $r = request('summary'); +# +echo print_r($r, true)."\n"; +# +?> diff --git a/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.py b/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.py new file mode 100644 index 0000000..470e303 --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/rpc-examples/api-example.py @@ -0,0 +1,62 @@ +#!/usr/bin/python +# Copyright 2013 Christian Berendt +# Copyright 2013 Luke Dashjr +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. See COPYING for more details. + +import argparse +import json +import logging +import pprint +import socket + +logging.basicConfig( + format='%(asctime)s %(levelname)s %(message)s', + level=logging.DEBUG +) + +parser = argparse.ArgumentParser() +parser.add_argument("command", default="summary", nargs='?') +parser.add_argument("parameter", default="", nargs='?') +parser.add_argument("--hostname", default="localhost") +parser.add_argument("--port", type=int, default=4028) +args = parser.parse_args() + +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + +try: + s.connect((args.hostname, args.port)) +except socket.error, e: + logging.error(e) + +try: + s.send("{\"command\" : \"%s\", \"parameter\" : \"%s\"}" + % (args.command, args.parameter) + ) +except socket.error, e: + logging.error(e) + + +data = '' +while True: + try: + newdata = s.recv(1024) + if newdata: + data += newdata + else: + break + except socket.error, e: + break + +try: + s.close() +except socket.error,e: + logging.error(e) + +if data: + data = json.loads(data.replace('\x00', '')) + pp = pprint.PrettyPrinter() + pp.pprint(data) diff --git a/bfgminer3.9/share/doc/bfgminer/rpc-examples/miner.php b/bfgminer3.9/share/doc/bfgminer/rpc-examples/miner.php new file mode 100644 index 0000000..12f913a --- /dev/null +++ b/bfgminer3.9/share/doc/bfgminer/rpc-examples/miner.php @@ -0,0 +1,3051 @@ +\n"; +# +# See README.RPC for more details of these variables and how +# to configure miner.php +# +# Web page title +$title = 'Mine'; +# +# Set $readonly to true to force miner.php to be readonly +# Set $readonly to false then it will check BFGMiner 'privileged' +$readonly = false; +# +# Set $userlist to null to allow anyone access or read README.RPC +$userlist = null; +# +# Set $per_proc to false to display only full device summaries +$per_proc = true; +# +# Set $notify to false to NOT attempt to display the notify command +# Set $notify to true to attempt to display the notify command +$notify = true; +# +# Set $checklastshare to true to do the following checks: +# If a device's last share is 12x expected ago then display as an error +# If a device's last share is 8x expected ago then display as a warning +# If either of the above is true, also display the whole line highlighted +# This assumes shares are 1 difficulty shares +$checklastshare = true; +# +# Set $poolinputs to true to show the input fields for adding a pool +# and changing the pool priorities +# N.B. also if $readonly is true, it will not display the fields +$poolinputs = false; +# +# Set $rigs to an array of your BFGMiner rigs that are running +# format: 'IP:Port' or 'Host:Port' or 'Host:Port:Name' +$rigs = array('127.0.0.1:4028'); +# +# Set $mcast to true to look for your rigs and ignore $rigs +$mcast = false; +# +# Set $mcastexpect to at least how many rigs you expect it to find +$mcastexpect = 0; +# +# API Multicast address all cgminers are listening on +$mcastaddr = '224.0.0.75'; +# +# API Multicast UDP port all cgminers are listening on +$mcastport = 4028; +# +# The code all cgminers expect in the Multicast message sent +$mcastcode = 'FTW'; +# +# UDP port cgminers are to reply on (by request) +$mcastlistport = 4027; +# +# Set $mcasttimeout to the number of seconds (floating point) +# to wait for replies to the Multicast message +$mcasttimeout = 1.5; +# +# Set $mcastretries to the number of times to retry the multicast +$mcastretries = 0; +# +# Set $allowgen to true to allow customsummarypages to use 'gen' +# false means ignore any 'gen' options +$allowgen = false; +# +# Set $rigipsecurity to false to show the IP/Port of the rig +# in the socket error messages and also show the full socket message +$rigipsecurity = true; +# +# Set $rigtotals to true to display totals on the single rig page +# 'false' means no totals (and ignores $forcerigtotals) +# You can force it to always show rig totals when there is only +# one line by setting $forcerigtotals = true; +$rigtotals = true; +$forcerigtotals = false; +# +# These should be OK for most cases +$socksndtimeoutsec = 10; +$sockrcvtimeoutsec = 40; +# +# List of fields NOT to be displayed +# This example would hide the slightly more sensitive pool information +#$hidefields = array('POOL.URL' => 1, 'POOL.User' => 1); +$hidefields = array(); +# +# Auto-refresh of the page (in seconds) - integers only +# $ignorerefresh = true/false always ignore refresh parameters +# $changerefresh = true/false show buttons to change the value +# $autorefresh = default value, 0 means dont auto-refresh +$ignorerefresh = false; +$changerefresh = true; +$autorefresh = 0; +# +# Should we allow custom pages? +# (or just completely ignore them and don't display the buttons) +$allowcustompages = true; +# +# OK this is a bit more complex item: Custom Summary Pages +# As mentioned above, see README.RPC +# see the example below (if there is no matching data, no total will show) +$mobilepage = array( + 'DATE' => null, + 'RIGS' => null, + 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', 'Accepted', 'Rejected=Rej', 'Utility'), + 'DEVS+NOTIFY' => array('DEVS.Name=Name', 'DEVS.ID=ID', 'DEVS.ProcID=Proc', + 'DEVS.Status=Status', 'DEVS.Temperature=Temp', + 'DEVS.MHS av=MHS av', 'DEVS.Accepted=Accept', 'DEVS.Rejected=Rej', + 'DEVS.Utility=Utility', 'NOTIFY.Last Not Well=Not Well'), + 'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected=Rej', 'Last Share Time')); +$mobilesum = array( + 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', 'Rejected', 'Utility'), + 'DEVS+NOTIFY' => array('DEVS.MHS av', 'DEVS.Accepted', 'DEVS.Rejected', 'DEVS.Utility'), + 'POOL' => array('Accepted', 'Rejected')); +# +$statspage = array( + 'DATE' => null, + 'RIGS' => null, + 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', + 'Accepted', 'Rejected=Rej', 'Utility', + 'Hardware Errors=HW Errs', 'Network Blocks=Net Blks', + 'Work Utility'), + 'COIN' => array('*'), + 'STATS' => array('*')); +# +$statssum = array( + 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', + 'Rejected', 'Utility', 'Hardware Errors', + 'Work Utility')); +# +$poolspage = array( + 'DATE' => null, + 'RIGS' => null, + 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', 'Accepted', 'Rejected=Rej', + 'Utility', 'Hardware Errors=HW Errs', 'Network Blocks=Net Blks'), + 'POOL+STATS' => array('STATS.ID=ID', 'POOL.URL=URL', + 'POOL.Has Stratum=Stratum', 'POOL.Stratum Active=StrAct', + 'STATS.Net Bytes Sent=NSent', + 'STATS.Net Bytes Recv=NRecv', 'GEN.AvShr=AvShr')); +# +$poolssum = array( + 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', + 'Rejected', 'Utility', 'Hardware Errors'), + 'POOL+STATS' => array( + 'STATS.Net Bytes Sent', + 'STATS.Net Bytes Recv')); +# +$poolsext = array( + 'POOL+STATS' => array( + 'where' => null, + 'group' => array('POOL.URL', 'POOL.Has Stratum', 'POOL.Stratum Active'), + 'calc' => array( + 'STATS.Net Bytes Sent' => 'sum', + 'STATS.Net Bytes Recv' => 'sum', + 'POOL.Accepted' => 'sum'), + 'gen' => array('AvShr' => 'round(POOL.Difficulty Accepted/max(POOL.Accepted,1)*100)/100'), + 'having' => array(array('STATS.Bytes Recv', '>', 0))) +); + +# +# customsummarypages is an array of these Custom Summary Pages +$customsummarypages = array('Mobile' => array($mobilepage, $mobilesum), + 'Stats' => array($statspage, $statssum), + 'Pools' => array($poolspage, $poolssum, $poolsext)); +# +$here = $_SERVER['PHP_SELF']; +# +global $tablebegin, $tableend, $warnfont, $warnoff, $dfmt; +# +$tablebegin = ''; +$tableend = '
'; +$warnfont = ''; +$warnoff = ''; +$dfmt = 'H:i:s j-M-Y \U\T\CP'; +# +$miner_font_family = 'Verdana, Arial, sans-serif, sans'; +$miner_font_size = '13pt'; +# +$bad_font_family = '"Times New Roman", Times, serif'; +$bad_font_size = '18pt'; +# +# Edit this or redefine it in myminer.php to change the colour scheme +# See $colourtable below for the list of names +$colouroverride = array(); +# +# Where to place the buttons: 'top' 'bot' 'both' +# anything else means don't show them - case sensitive +$placebuttons = 'top'; +# +# This below allows you to put your own settings into a seperate file +# so you don't need to update miner.php with your preferred settings +# every time a new version is released +# Just create the file 'myminer.php' in the same directory as +# 'miner.php' - and put your own settings in there +if (file_exists('myminer.php')) + include_once('myminer.php'); +# +# This is the system default that must always contain all necessary +# colours so it must be a constant +# You can override these values with $colouroverride +# The only one missing is $warnfont +# - which you can override directly anyway +global $colourtable; +$colourtable = array( + 'body bgcolor' => '#ecffff', + 'td color' => 'blue', + 'td.two color' => 'blue', + 'td.two background' => '#ecffff', + 'td.h color' => 'blue', + 'td.h background' => '#c4ffff', + 'td.err color' => 'black', + 'td.err background' => '#ff3050', + 'td.bad color' => 'black', + 'td.bad background' => '#ff3050', + 'td.warn color' => 'black', + 'td.warn background' => '#ffb050', + 'td.sta color' => 'green', + 'td.tot color' => 'blue', + 'td.tot background' => '#fff8f2', + 'td.lst color' => 'blue', + 'td.lst background' => '#ffffdd', + 'td.hi color' => 'blue', + 'td.hi background' => '#f6ffff', + 'td.lo color' => 'blue', + 'td.lo background' => '#deffff' +); +# +# Don't touch these 2 +$miner = null; +$port = null; +# +# Ensure it is only ever shown once +global $showndate; +$showndate = false; +# +# For summary page to stop retrying failed rigs +global $rigerror; +$rigerror = array(); +# +global $rownum; +$rownum = 0; +# +// Login +global $ses; +$ses = 'rutroh'; +# +function getcss($cssname, $dom = false) +{ + global $colourtable, $colouroverride; + + $css = ''; + foreach ($colourtable as $cssdata => $value) + { + $cssobj = explode(' ', $cssdata, 2); + if ($cssobj[0] == $cssname) + { + if (isset($colouroverride[$cssdata])) + $value = $colouroverride[$cssdata]; + + if ($dom == true) + $css .= ' '.$cssobj[1].'='.$value; + else + $css .= $cssobj[1].':'.$value.'; '; + } + } + return $css; +} +# +function getdom($domname) +{ + return getcss($domname, true); +} +# +function htmlhead($mcerr, $checkapi, $rig, $pg = null, $noscript = false) +{ + global $doctype, $title, $miner_font_family, $miner_font_size; + global $bad_font_family, $bad_font_size; + global $error, $readonly, $poolinputs, $here; + global $ignorerefresh, $autorefresh; + + $extraparams = ''; + if ($rig != null && $rig != '') + $extraparams = "&rig=$rig"; + else + if ($pg != null && $pg != '') + $extraparams = "&pg=$pg"; + + if ($ignorerefresh == true || $autorefresh == 0) + $refreshmeta = ''; + else + { + $url = "$here?ref=$autorefresh$extraparams"; + $refreshmeta = "\n"; + } + + if ($readonly === false && $checkapi === true) + { + $error = null; + $access = api($rig, 'privileged'); + if ($error != null + || !isset($access['STATUS']['STATUS']) + || $access['STATUS']['STATUS'] != 'S') + $readonly = true; + } + $miner_font = "font-family:$miner_font_family; font-size:$miner_font_size;"; + $bad_font = "font-family:$bad_font_family; font-size:$bad_font_size;"; + + echo "$doctype$refreshmeta +$title + +\n"; +if ($noscript === false) +{ +echo "\n"; +} +?> + +
+ + 0); + do + { + $mcast_soc = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + if ($mcast_soc === false || $mcast_soc == null) + { + $msg = "ERR: mcast send socket create(UDP) failed"; + if ($rigipsecurity === false) + { + $error = socket_strerror(socket_last_error()); + $error = "$msg '$error'\n"; + } + else + $error = "$msg\n"; + + socket_close($rep_soc); + return; + } + + $buf = "cgminer-$mcastcode-$mcastlistport"; + socket_sendto($mcast_soc, $buf, strlen($buf), 0, $mcastaddr, $mcastport); + socket_close($mcast_soc); + + $stt = microtime(true); + while (true) + { + $got = @socket_recvfrom($rep_soc, $buf, 32, MSG_DONTWAIT, $ip, $p); + if ($got !== false && $got > 0) + { + $ans = explode('-', $buf, 4); + if (count($ans) >= 3 && $ans[0] == 'cgm' && $ans[1] == 'FTW') + { + $rp = intval($ans[2]); + + if (count($ans) > 3) + $mdes = str_replace("\0", '', $ans[3]); + else + $mdes = ''; + + if (strlen($mdes) > 0) + $rig = "$ip:$rp:$mdes"; + else + $rig = "$ip:$rp"; + + if (!in_array($rig, $rigs)) + $rigs[] = $rig; + } + } + if ((microtime(true) - $stt) >= $mcasttimeout) + break; + + usleep(100000); + } + + if ($mcastexpect > 0 && count($rigs) >= $mcastexpect) + $doretry = false; + + } while ($doretry && --$retries > 0); + + socket_close($rep_soc); +} +# +function getrigs() +{ + global $rigs; + + mcastrigs(); + + sort($rigs); +} +# +function getsock($rig, $addr, $port) +{ + global $rigipsecurity; + global $haderror, $error, $socksndtimeoutsec, $sockrcvtimeoutsec; + + $error = null; + $socket = null; + $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + if ($socket === false || $socket === null) + { + $haderror = true; + if ($rigipsecurity === false) + { + $error = socket_strerror(socket_last_error()); + $msg = "socket create(TCP) failed"; + $error = "ERR: $msg '$error'\n"; + } + else + $error = "ERR: socket create(TCP) failed\n"; + + return null; + } + + // Ignore if this fails since the socket connect may work anyway + // and nothing is gained by aborting if the option cannot be set + // since we don't know in advance if it can connect + socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $socksndtimeoutsec, 'usec' => 0)); + socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $sockrcvtimeoutsec, 'usec' => 0)); + + $res = socket_connect($socket, $addr, $port); + if ($res === false) + { + $haderror = true; + if ($rigipsecurity === false) + { + $error = socket_strerror(socket_last_error()); + $msg = "socket connect($addr,$port) failed"; + $error = "ERR: $msg '$error'\n"; + } + else + $error = "ERR: socket connect($rig) failed\n"; + + socket_close($socket); + return null; + } + return $socket; +} +# +function readsockline($socket) +{ + $line = ''; + while (true) + { + $byte = socket_read($socket, 1); + if ($byte === false || $byte === '') + break; + if ($byte === "\0") + break; + $line .= $byte; + } + return $line; +} +# +function api_convert_escape($str) +{ + $res = ''; + $len = strlen($str); + for ($i = 0; $i < $len; $i++) + { + $ch = substr($str, $i, 1); + if ($ch != '\\' || $i == ($len-1)) + $res .= $ch; + else + { + $i++; + $ch = substr($str, $i, 1); + switch ($ch) + { + case '|': + $res .= "\1"; + break; + case '\\': + $res .= "\2"; + break; + case '=': + $res .= "\3"; + break; + case ',': + $res .= "\4"; + break; + default: + $res .= $ch; + } + } + } + return $res; +} +# +function revert($str) +{ + return str_replace(array("\1", "\2", "\3", "\4"), array("|", "\\", "=", ","), $str); +} +# +function api($rig, $cmd) +{ + global $haderror, $error; + global $miner, $port, $hidefields; + global $per_proc; + + if ($per_proc) + { + $cmd = preg_replace('/^devs\b/', 'procs', $cmd); + $cmd = preg_replace('/^pga/', 'proc', $cmd); + } + + $socket = getsock($rig, $miner, $port); + if ($socket != null) + { + socket_write($socket, $cmd, strlen($cmd)); + $line = readsockline($socket); + socket_close($socket); + + if (strlen($line) == 0) + { + $haderror = true; + $error = "WARN: '$cmd' returned nothing\n"; + return $line; + } + +# print "$cmd returned '$line'\n"; + + $line = api_convert_escape($line); + + $data = array(); + + $objs = explode('|', $line); + foreach ($objs as $obj) + { + if (strlen($obj) > 0) + { + $items = explode(',', $obj); + $item = $items[0]; + $id = explode('=', $items[0], 2); + if (count($id) == 1 or !ctype_digit($id[1])) + $name = $id[0]; + else + $name = $id[0].$id[1]; + + if (strlen($name) == 0) + $name = 'null'; + + $sectionname = preg_replace('/\d/', '', $name); + + if (isset($data[$name])) + { + $num = 1; + while (isset($data[$name.$num])) + $num++; + $name .= $num; + } + + $counter = 0; + foreach ($items as $item) + { + $id = explode('=', $item, 2); + + if (isset($hidefields[$sectionname.'.'.$id[0]])) + continue; + + if (count($id) == 2) + $data[$name][$id[0]] = revert($id[1]); + else + $data[$name][$counter] = $id[0]; + + $counter++; + } + } + } + return $data; + } + return null; +} +# +function getparam($name, $both = false) +{ + $a = null; + if (isset($_POST[$name])) + $a = $_POST[$name]; + + if (($both === true) and ($a === null)) + { + if (isset($_GET[$name])) + $a = $_GET[$name]; + } + + if ($a == '' || $a == null) + return null; + + // limit to 1K just to be safe + return substr($a, 0, 1024); +} +# +function newtable() +{ + global $tablebegin, $rownum; + echo $tablebegin; + $rownum = 0; +} +# +function newrow() +{ + echo ''; +} +# +function othrow($row) +{ + return "$row"; +} +# +function otherrow($row) +{ + echo othrow($row); +} +# +function endrow() +{ + global $rownum; + echo ''; + $rownum++; +} +# +function endtable() +{ + global $tableend; + echo $tableend; +} +# +function classlastshare($when, $alldata, $warnclass, $errorclass) +{ + global $checklastshare; + + if ($checklastshare === false) + return ''; + + if ($when == 0) + return ''; + + if (!isset($alldata['MHS av'])) + return ''; + + if ($alldata['MHS av'] == 0) + return ''; + + if (!isset($alldata['Last Share Time'])) + return ''; + + if (!isset($alldata['Last Share Difficulty'])) + return ''; + + $expected = pow(2, 32) / ($alldata['MHS av'] * pow(10, 6)); + + // If the share difficulty changes while waiting on a share, + // this calculation will of course be incorrect + $expected *= $alldata['Last Share Difficulty']; + + $howlong = $when - $alldata['Last Share Time']; + if ($howlong < 1) + $howlong = 1; + + if ($howlong > ($expected * 12)) + return $errorclass; + + if ($howlong > ($expected * 8)) + return $warnclass; + + return ''; +} +# +function endzero($num) +{ + $rep = preg_replace('/0*$/', '', $num); + if ($rep === '') + $rep = '0'; + return $rep; +} +# +function fmt($section, $name, $value, $when, $alldata) +{ + global $dfmt, $rownum; + + if ($alldata == null) + $alldata = array(); + + $errorclass = ' class=err'; + $warnclass = ' class=warn'; + $lstclass = ' class=lst'; + $hiclass = ' class=hi'; + $loclass = ' class=lo'; + $c2class = ' class=two'; + $totclass = ' class=tot'; + $b = ' '; + + $ret = $value; + $class = ''; + + $nams = explode('.', $name); + if (count($nams) > 1) + $name = $nams[count($nams)-1]; + + if ($value === null) + $ret = $b; + else + switch ($section.'.'.$name) + { + case 'GPU.Last Share Time': + case 'PGA.Last Share Time': + case 'DEVS.Last Share Time': + if ($value == 0 + || (isset($alldata['Last Share Pool']) && $alldata['Last Share Pool'] == -1)) + { + $ret = 'Never'; + $class = $warnclass; + } + else + { + $ret = date('H:i:s', $value); + $class = classlastshare($when, $alldata, $warnclass, $errorclass); + } + break; + case 'GPU.Last Valid Work': + case 'PGA.Last Valid Work': + case 'DEVS.Last Valid Work': + if ($value == 0) + $ret = 'Never'; + else + $ret = ($value - $when) . 's'; + break; + case 'POOL.Last Share Time': + if ($value == 0) + $ret = 'Never'; + else + $ret = date('H:i:s d-M', $value); + break; + case 'GPU.Last Share Pool': + case 'PGA.Last Share Pool': + case 'DEVS.Last Share Pool': + if ($value == -1) + { + $ret = 'None'; + $class = $warnclass; + } + break; + case 'SUMMARY.Elapsed': + case 'STATS.Elapsed': + $s = $value % 60; + $value -= $s; + $value /= 60; + if ($value == 0) + $ret = $s.'s'; + else + { + $m = $value % 60; + $value -= $m; + $value /= 60; + if ($value == 0) + $ret = sprintf("%dm$b%02ds", $m, $s); + else + { + $h = $value % 24; + $value -= $h; + $value /= 24; + if ($value == 0) + $ret = sprintf("%dh$b%02dm$b%02ds", $h, $m, $s); + else + { + if ($value == 1) + $days = ''; + else + $days = 's'; + + $ret = sprintf("%dday$days$b%02dh$b%02dm$b%02ds", $value, $h, $m, $s); + } + } + } + break; + case 'NOTIFY.Last Well': + if ($value == '0') + { + $ret = 'Never'; + $class = $warnclass; + } + else + $ret = date('H:i:s', $value); + break; + case 'NOTIFY.Last Not Well': + if ($value == '0') + $ret = 'Never'; + else + { + $ret = date('H:i:s', $value); + $class = $errorclass; + } + break; + case 'NOTIFY.Reason Not Well': + if ($value != 'None') + $class = $errorclass; + break; + case 'GPU.Utility': + case 'PGA.Utility': + case 'DEVS.Utility': + case 'SUMMARY.Utility': + case 'total.Utility': + $ret = $value.'/m'; + if ($value == 0) + $class = $errorclass; + else + if (isset($alldata['Difficulty Accepted']) + && isset($alldata['Accepted']) + && isset($alldata['MHS av']) + && ($alldata['Difficulty Accepted'] > 0) + && ($alldata['Accepted'] > 0)) + { + $expected = 60 * $alldata['MHS av'] * (pow(10, 6) / pow(2, 32)); + if ($expected == 0) + $expected = 0.000001; // 1 H/s + + $da = $alldata['Difficulty Accepted']; + $a = $alldata['Accepted']; + $expected /= ($da / $a); + + $ratio = $value / $expected; + if ($ratio < 0.9) + $class = $loclass; + else + if ($ratio > 1.1) + $class = $hiclass; + } + break; + case 'PGA.Temperature': + case 'GPU.Temperature': + case 'DEVS.Temperature': + $ret = $value.'°C'; + if (!isset($alldata['GPU'])) + { + if ($value == 0) + $ret = ' '; + break; + } + case 'GPU.GPU Clock': + case 'DEVS.GPU Clock': + case 'GPU.Memory Clock': + case 'DEVS.Memory Clock': + case 'GPU.GPU Voltage': + case 'DEVS.GPU Voltage': + case 'GPU.GPU Activity': + case 'DEVS.GPU Activity': + if ($value == 0) + $class = $warnclass; + break; + case 'GPU.Fan Percent': + case 'DEVS.Fan Percent': + if ($value == 0) + $class = $warnclass; + else + { + if ($value == 100) + $class = $errorclass; + else + if ($value > 85) + $class = $warnclass; + } + break; + case 'GPU.Fan Speed': + case 'DEVS.Fan Speed': + if ($value == 0) + $class = $warnclass; + else + if (isset($alldata['Fan Percent'])) + { + $test = $alldata['Fan Percent']; + if ($test == 100) + $class = $errorclass; + else + if ($test > 85) + $class = $warnclass; + } + break; + case 'GPU.MHS av': + case 'PGA.MHS av': + case 'DEVS.MHS av': + case 'SUMMARY.MHS av': + case 'total.MHS av': + $parts = explode('.', $value, 2); + if (count($parts) == 1) + $dec = ''; + else + $dec = '.'.$parts[1]; + $ret = number_format((float)$parts[0]).$dec; + + if ($value == 0) + $class = $errorclass; + else + if (isset($alldata['Difficulty Accepted']) + && isset($alldata['Accepted']) + && isset($alldata['Utility']) + && ($alldata['Difficulty Accepted'] > 0) + && ($alldata['Accepted'] > 0)) + { + $expected = 60 * $value * (pow(10, 6) / pow(2, 32)); + if ($expected == 0) + $expected = 0.000001; // 1 H/s + + $da = $alldata['Difficulty Accepted']; + $a = $alldata['Accepted']; + $expected /= ($da / $a); + + $ratio = $alldata['Utility'] / $expected; + if ($ratio < 0.9) + $class = $hiclass; + else + if ($ratio > 1.1) + $class = $loclass; + } + break; + case 'GPU.Total MH': + case 'PGA.Total MH': + case 'DEVS.Total MH': + case 'SUMMARY.Total MH': + case 'total.Total MH': + case 'SUMMARY.Getworks': + case 'POOL.Getworks': + case 'total.Getworks': + case 'GPU.Accepted': + case 'PGA.Accepted': + case 'DEVS.Accepted': + case 'SUMMARY.Accepted': + case 'POOL.Accepted': + case 'total.Accepted': + case 'GPU.Rejected': + case 'PGA.Rejected': + case 'DEVS.Rejected': + case 'SUMMARY.Rejected': + case 'POOL.Rejected': + case 'total.Rejected': + case 'SUMMARY.Local Work': + case 'total.Local Work': + case 'SUMMARY.Discarded': + case 'POOL.Discarded': + case 'total.Discarded': + case 'POOL.Diff1 Shares': + case 'total.Diff1 Shares': + case 'GPU.Diff1 Work': + case 'PGA.Diff1 Work': + case 'total.Diff1 Work': + case 'STATS.Times Sent': + case 'STATS.Bytes Sent': + case 'STATS.Net Bytes Sent': + case 'STATS.Times Recv': + case 'STATS.Bytes Recv': + case 'STATS.Net Bytes Recv': + case 'total.Times Sent': + case 'total.Bytes Sent': + case 'total.Net Bytes Sent': + case 'total.Times Recv': + case 'total.Bytes Recv': + case 'total.Net Bytes Recv': + $parts = explode('.', $value, 2); + if (count($parts) == 1) + $dec = ''; + else + $dec = '.'.$parts[1]; + $ret = number_format((float)$parts[0]).$dec; + break; + case 'STATS.Hs': + case 'STATS.W': + case 'STATS.history_time': + case 'STATS.Pool Wait': + case 'STATS.Pool Max': + case 'STATS.Pool Min': + case 'STATS.Pool Av': + case 'STATS.Min Diff': + case 'STATS.Max Diff': + case 'STATS.Work Diff': + $parts = explode('.', $value, 2); + if (count($parts) == 1) + $dec = ''; + else + $dec = '.'.endzero($parts[1]); + $ret = number_format((float)$parts[0]).$dec; + break; + case 'GPU.Status': + case 'PGA.Status': + case 'DEVS.Status': + case 'POOL.Status': + if ($value != 'Alive') + $class = $errorclass; + break; + case 'GPU.Enabled': + case 'PGA.Enabled': + case 'DEVS.Enabled': + if ($value != 'Y') + $class = $warnclass; + break; + case 'STATUS.When': + case 'COIN.Current Block Time': + $ret = date($dfmt, $value); + break; + case 'BUTTON.Rig': + case 'BUTTON.Pool': + case 'BUTTON.GPU': + $ret = $value; + break; + case 'SUMMARY.Difficulty Accepted': + case 'GPU.Difficulty Accepted': + case 'PGA.Difficulty Accepted': + case 'DEVS.Difficulty Accepted': + case 'POOL.Difficulty Accepted': + case 'total.Difficulty Accepted': + case 'SUMMARY.Difficulty Rejected': + case 'GPU.Difficulty Rejected': + case 'PGA.Difficulty Rejected': + case 'DEVS.Difficulty Rejected': + case 'POOL.Difficulty Rejected': + case 'total.Difficulty Rejected': + case 'SUMMARY.Difficulty Stale': + case 'POOL.Difficulty Stale': + case 'total.Difficulty Stale': + case 'GPU.Last Share Difficulty': + case 'PGA.Last Share Difficulty': + case 'DEVS.Last Share Difficulty': + case 'POOL.Last Share Difficulty': + if ($value != '') + $ret = number_format((float)$value, 2); + break; + case 'DEVS.Device Hardware%': + case 'DEVS.Device Rejected%': + case 'PGA.Device Hardware%': + case 'PGA.Device Rejected%': + case 'GPU.Device Hardware%': + case 'GPU.Device Rejected%': + case 'POOL.Pool Rejected%': + case 'POOL.Pool Stale%': + case 'SUMMARY.Device Hardware%': + case 'SUMMARY.Device Rejected%': + case 'SUMMARY.Pool Rejected%': + case 'SUMMARY.Pool Stale%': + if ($value != '') + $ret = number_format((float)$value, 2) . '%'; + break; + case 'SUMMARY.Best Share': + if ($value != '') + $ret = number_format((float)$value); + break; + } + + if ($section == 'NOTIFY' && substr($name, 0, 1) == '*' && $value != '0') + $class = $errorclass; + + if ($class == '' && $section != 'POOL') + $class = classlastshare($when, $alldata, $lstclass, $lstclass); + + if ($class == '' && $section == 'total') + $class = $totclass; + + if ($class == '' && ($rownum % 2) == 0) + $class = $c2class; + + if ($ret === '') + $ret = $b; + + return array($ret, $class); +} +# +global $poolcmd; +$poolcmd = array( 'Switch to' => 'switchpool', + 'Enable' => 'enablepool', + 'Disable' => 'disablepool', + 'Remove' => 'removepool' ); +# +function showhead($cmd, $values, $justnames = false) +{ + global $poolcmd, $readonly; + + newrow(); + + foreach ($values as $name => $value) + { + if ($name == '0' or $name == '') + $name = ' '; + echo ""; + } + + if ($justnames === false && $cmd == 'pools' && $readonly === false) + foreach ($poolcmd as $name => $pcmd) + echo ""; + + endrow(); +} +# +function showdatetime() +{ + global $dfmt; + + otherrow(''); +} +# +global $singlerigsum; +$singlerigsum = array( + 'devs' => array('MHS av' => 1, 'MHS 5s' => 1, 'Accepted' => 1, 'Rejected' => 1, + 'Temperature' => 2, + 'Hardware Errors' => 1, 'Utility' => 1, 'Total MH' => 1), + 'pools' => array('Getworks' => 1, 'Accepted' => 1, 'Rejected' => 1, 'Discarded' => 1, + 'Stale' => 1, 'Get Failures' => 1, 'Remote Failures' => 1), + 'notify' => array('*' => 1)); +# +function showtotal($total, $when, $oldvalues) +{ + global $rigtotals; + + list($showvalue, $class) = fmt('total', '', 'Total:', $when, null); + echo "$showvalue"; + + $skipfirst = true; + foreach ($oldvalues as $name => $value) + { + if ($skipfirst === true) + { + $skipfirst = false; + continue; + } + + if (isset($total[$name])) + $newvalue = $total[$name]; + else + $newvalue = ''; + + list($showvalue, $class) = fmt('total', $name, $newvalue, $when, null); + echo "$showvalue"; + } +} +# +function details($cmd, $list, $rig) +{ + global $dfmt, $poolcmd, $readonly, $showndate; + global $rownum, $rigtotals, $forcerigtotals, $singlerigsum; + + $when = 0; + + $stas = array('S' => 'Success', 'W' => 'Warning', 'I' => 'Informational', 'E' => 'Error', 'F' => 'Fatal'); + + newtable(); + + if ($showndate === false) + { + showdatetime(); + + endtable(); + newtable(); + + $showndate = true; + } + + if (isset($list['STATUS'])) + { + newrow(); + echo ''; + if (isset($list['STATUS']['When'])) + { + echo ''; + $when = $list['STATUS']['When']; + } + $sta = $list['STATUS']['STATUS']; + echo ''; + echo ''; + endrow(); + } + + if ($rigtotals === true && isset($singlerigsum[$cmd])) + $dototal = $singlerigsum[$cmd]; + else + $dototal = array(); + $total = array(); + + $section = ''; + $oldvalues = null; + + // Build a common row column for all entries + $columns = array(); + $columnsByIndex = array(); + foreach ($list as $item => $values) + { + if ($item == 'STATUS') + continue; + if (isset($values['ID'])) + { + $repr = $values['Name'].$values['ID']; + if (isset($values['ProcID'])) + $repr .= join_get_field('ProcID', $values); + $list[$item] = $values = array('Device' => $repr) + array_slice($values, 1); + unset($values['Name']); + unset($values['ID']); + unset($values['ProcID']); + } + $namesByIndex = array_keys($values); + $nameCount = count($namesByIndex); + for ($i = 0; $i < $nameCount; ++$i) + { + $name = $namesByIndex[$i]; + if (isset($columns[$name])) + continue; + $value = $values[$name]; + $before = null; + for ($j = $i + 1; $j < $nameCount; ++$j) + { + $maybebefore = $namesByIndex[$j]; + if (isset($columns[$maybebefore])) + { + $before = $columns[$maybebefore]; + break; + } + } + if (!$before) + { + $columns[$name] = array_push($columnsByIndex, $name) - 1; + continue; + } + array_splice($columnsByIndex, $before, 0, $name); + $columns[$name] = $before; + $columnCount = count($columnsByIndex); + for ($j = $before + 1; $j < $columnCount; ++$j) + $columns[$columnsByIndex[$j]] = $j; + } + } + asort($columns); + endtable(); + newtable(); + showhead($cmd, $columns); + + foreach ($list as $item => $values) + { + if ($item == 'STATUS') + continue; + + newrow(); + + foreach ($columns as $name => $columnidx) + { + if (!isset($values[$name])) + { + echo ''; + continue; + } + $value = $values[$name]; + + list($showvalue, $class) = fmt($section, $name, $value, $when, $values); + echo "$showvalue"; + + if (isset($dototal[$name]) + || (isset($dototal['*']) and substr($name, 0, 1) == '*')) + { + if (isset($total[$name])) + { + if (isset($dototal[$name]) && $dototal[$name] == 2) + $total[$name] = max($total[$name], $value); + else + $total[$name] += $value; + } + else + $total[$name] = $value; + } + } + + if ($cmd == 'pools' && $readonly === false) + { + reset($values); + $pool = current($values); + foreach ($poolcmd as $name => $pcmd) + { + list($ignore, $class) = fmt('BUTTON', 'Pool', '', $when, $values); + echo ""; + if ($pool === false) + echo ' '; + else + { + echo ""; + } + echo ''; + } + } + endrow(); + + $oldvalues = $values; + } + + if ($oldvalues != null && count($total) > 0 + && ($rownum > 2 || $forcerigtotals === true)) + showtotal($total, $when, $columns); + + endtable(); +} +# +global $devs; +$devs = null; +# +function gpubuttons($count, $rig) +{ + global $devs; + + $basic = array( 'GPU', 'Enable', 'Disable', 'Restart' ); + + $options = array( 'intensity' => 'Intensity', + 'fan' => 'Fan Percent', + 'engine' => 'GPU Clock', + 'mem' => 'Memory Clock', + 'vddc' => 'GPU Voltage' ); + + newtable(); + newrow(); + + foreach ($basic as $head) + echo ""; + + foreach ($options as $name => $des) + echo ""; + + $n = 0; + for ($c = 0; $c < $count; $c++) + { + endrow(); + newrow(); + + foreach ($basic as $name) + { + list($ignore, $class) = fmt('BUTTON', 'GPU', '', 0, null); + echo ""; + + if ($name == 'GPU') + echo $c; + else + { + echo ""; + } + + echo ''; + } + + foreach ($options as $name => $des) + { + list($ignore, $class) = fmt('BUTTON', 'GPU', '', 0, null); + echo ""; + + if (!isset($devs["GPU$c"][$des])) + echo ' '; + else + { + $value = $devs["GPU$c"][$des]; + echo ""; + echo ""; + $n++; + } + + echo ''; + } + + } + endrow(); + endtable(); +} +# +function processgpus($rig) +{ + global $error; + global $warnfont, $warnoff; + + $gpus = api($rig, 'gpucount'); + + if ($error != null) + otherrow(""); + else + { + if (!isset($gpus['GPUS']['Count'])) + { + $rw = ''; + otherrow($rw); + } + else + { + $count = $gpus['GPUS']['Count']; + if ($count == 0) + otherrow(''); + else + gpubuttons($count, $rig); + } + } +} +# +function showpoolinputs($rig, $ans) +{ + global $readonly, $poolinputs; + + if ($readonly === true || $poolinputs === false) + return; + + newtable(); + newrow(); + + $inps = array('Pool URL' => array('purl', 20), + 'Worker Name' => array('pwork', 10), + 'Worker Password' => array('ppass', 10)); + $b = ' '; + + echo ""; + + endrow(); + + if (count($ans) > 1) + { + newrow(); + + echo ''; + echo ""; + + endrow(); + } + endtable(); +} +# +function process($cmds, $rig) +{ + global $error, $devs; + global $warnfont, $warnoff; + + $count = count($cmds); + foreach ($cmds as $cmd => $des) + { + $process = api($rig, $cmd); + + if ($error != null) + { + otherrow(""); + break; + } + else + { + details($cmd, $process, $rig); + + if ($cmd == 'devs') + $devs = $process; + + if ($cmd == 'pools') + showpoolinputs($rig, $process); + + # Not after the last one + if (--$count > 0) + otherrow(''); + } + } +} +# +function rigname($rig, $rigname) +{ + global $rigs; + + if (isset($rigs[$rig])) + { + $parts = explode(':', $rigs[$rig], 3); + if (count($parts) == 3) + $rigname = $parts[2]; + } + + return $rigname; +} +# +function riginput($rig, $rigname) +{ + $rigname = rigname($rig, $rigname); + + return ""; +} +# +function rigbutton($rig, $rigname, $when, $row) +{ + list($value, $class) = fmt('BUTTON', 'Rig', '', $when, $row); + + if ($rig === '') + $ri = ' '; + else + $ri = riginput($rig, $rigname); + + return ""; +} +# +function showrigs($anss, $headname, $rigname) +{ + $dthead = array($headname => 1, 'STATUS' => 1, 'Description' => 1, 'When' => 1, 'API' => 1, 'CGMiner' => 1); + showhead('', $dthead); + + foreach ($anss as $rig => $ans) + { + if ($ans == null) + continue; + + newrow(); + + $when = 0; + if (isset($ans['STATUS']['When'])) + $when = $ans['STATUS']['When']; + + foreach ($ans as $item => $row) + { + if ($item != 'STATUS' && $item != 'VERSION') + continue; + + foreach ($dthead as $name => $x) + { + if ($item == 'STATUS' && $name == $headname) + echo rigbutton($rig, $rigname.$rig, $when, null); + else + { + if (isset($row[$name])) + { + list($showvalue, $class) = fmt('STATUS', $name, $row[$name], $when, null); + echo "$showvalue"; + } + } + } + } + endrow(); + } +} +# +# $head is a hack but this is just a demo anyway :) +function doforeach($cmd, $des, $sum, $head, $datetime) +{ + global $miner, $port; + global $error, $readonly, $notify, $rigs; + global $warnfont, $warnoff, $dfmt; + global $rigerror; + + $when = 0; + + $header = $head; + $anss = array(); + + $count = 0; + $preverr = count($rigerror); + foreach ($rigs as $num => $rig) + { + $anss[$num] = null; + + if (isset($rigerror[$rig])) + continue; + + $parts = explode(':', $rig, 3); + if (count($parts) >= 2) + { + $miner = $parts[0]; + $port = $parts[1]; + + if (count($parts) > 2) + $name = $parts[2]; + else + $name = $num; + + $ans = api($name, $cmd); + + if ($error != null) + { + $rw = ""; + otherrow($rw); + $rigerror[$rig] = $error; + $error = null; + } + else + { + $anss[$num] = $ans; + $count++; + } + } + } + + if ($count == 0) + { + $rw = ''; + otherrow($rw); + return; + } + + if ($datetime) + { + showdatetime(); + endtable(); + newtable(); + showrigs($anss, '', 'Rig '); + endtable(); + otherrow(''); + newtable(); + + return; + } + + $total = array(); + + foreach ($anss as $rig => $ans) + { + if ($ans == null) + continue; + + foreach ($ans as $item => $row) + { + if ($item == 'STATUS') + continue; + + if (count($row) > count($header)) + { + $header = $head; + foreach ($row as $name => $value) + if (!isset($header[$name])) + $header[$name] = ''; + } + + if ($sum != null) + foreach ($sum as $name) + { + if (isset($row[$name])) + { + if (isset($total[$name])) + $total[$name] += $row[$name]; + else + $total[$name] = $row[$name]; + } + } + } + } + + if ($sum != null) + $anss['total']['total'] = $total; + + showhead('', $header); + + foreach ($anss as $rig => $ans) + { + if ($ans == null) + continue; + + $when = 0; + if (isset($ans['STATUS']['When'])) + $when = $ans['STATUS']['When']; + + foreach ($ans as $item => $row) + { + if ($item == 'STATUS') + continue; + + newrow(); + + $section = preg_replace('/\d/', '', $item); + + foreach ($header as $name => $x) + { + if ($name == '') + { + if ($rig === 'total') + { + list($ignore, $class) = fmt($rig, '', '', $when, $row); + echo ""; + } + else + echo rigbutton($rig, "Rig $rig", $when, $row); + } + else + { + if (isset($row[$name])) + $value = $row[$name]; + else + $value = null; + + list($showvalue, $class) = fmt($section, $name, $value, $when, $row); + echo "$showvalue"; + } + } + endrow(); + } + } +} +# +function refreshbuttons() +{ + global $ignorerefresh, $changerefresh, $autorefresh; + + if ($ignorerefresh == false && $changerefresh == true) + { + echo '    '; + echo ""; + echo ""; + echo ""; + } +} +# +function pagebuttons($rig, $pg) +{ + global $readonly, $rigs, $userlist, $ses; + global $allowcustompages, $customsummarypages; + + if ($rig === null) + { + $prev = null; + $next = null; + + if ($pg === null) + $refresh = ''; + else + $refresh = "&pg=$pg"; + } + else + { + switch (count($rigs)) + { + case 0: + case 1: + $prev = null; + $next = null; + break; + case 2: + $prev = null; + $next = ($rig + 1) % count($rigs); + break; + default: + $prev = ($rig - 1) % count($rigs); + $next = ($rig + 1) % count($rigs); + break; + } + + $refresh = "&rig=$rig"; + } + + echo '"; +} +# +function doOne($rig, $preprocess) +{ + global $haderror, $readonly, $notify, $rigs; + global $placebuttons; + + if ($placebuttons == 'top' || $placebuttons == 'both') + pagebuttons($rig, null); + + if ($preprocess != null) + process(array($preprocess => $preprocess), $rig); + + $cmds = array( 'devs' => 'device list', + 'summary' => 'summary information', + 'pools' => 'pool list'); + + if ($notify) + $cmds['notify'] = 'device status'; + + $cmds['config'] = 'BFGMiner config'; + + process($cmds, $rig); + + if ($haderror == false && $readonly === false) + processgpus($rig); + + if ($placebuttons == 'bot' || $placebuttons == 'both') + pagebuttons($rig, null); +} +# +global $sectionmap; +# map sections to their api command +# DEVS is a special case that will match GPU or PGA +# so you can have a single table with both in it +# DATE is hard coded so not in here +$sectionmap = array( + 'RIGS' => 'version', + 'SUMMARY' => 'summary', + 'POOL' => 'pools', + 'DEVS' => 'devs', + 'GPU' => 'devs', // You would normally use DEVS + 'PGA' => 'devs', // You would normally use DEVS + 'NOTIFY' => 'notify', + 'DEVDETAILS' => 'devdetails', + 'STATS' => 'stats', + 'CONFIG' => 'config', + 'COIN' => 'coin'); +# +function joinfields($section1, $section2, $join, $results) +{ + global $sectionmap; + + $name1 = $sectionmap[$section1]; + $name2 = $sectionmap[$section2]; + $newres = array(); + + // foreach rig in section1 + foreach ($results[$name1] as $rig => $result) + { + $status = null; + + // foreach answer section in the rig api call + foreach ($result as $name1b => $fields1b) + { + if ($name1b == 'STATUS') + { + // remember the STATUS from section1 + $status = $result[$name1b]; + continue; + } + + // foreach answer section in the rig api call (for the other api command) + foreach ($results[$name2][$rig] as $name2b => $fields2b) + { + if ($name2b == 'STATUS') + continue; + + // If match the same field values of fields in $join + $match = true; + foreach ($join as $field) + if ($fields1b[$field] != $fields2b[$field]) + { + $match = false; + break; + } + + if ($match === true) + { + if ($status != null) + { + $newres[$rig]['STATUS'] = $status; + $status = null; + } + + $subsection = $section1.'+'.$section2; + $subsection .= preg_replace('/[^0-9]/', '', $name1b.$name2b); + + foreach ($fields1b as $nam => $val) + $newres[$rig][$subsection]["$section1.$nam"] = $val; + foreach ($fields2b as $nam => $val) + $newres[$rig][$subsection]["$section2.$nam"] = $val; + } + } + } + } + return $newres; +} +# +function join_get_field($field, $fields) +{ + // : means a string constant otherwise it's a field name + // ProcID field name is converted to a lowercase letter + if (substr($field, 0, 1) == ':') + return substr($field, 1); + else + if ($field == 'ProcID') + return chr(97 + $fields[$field]); + else + return $fields[$field]; +} +# +function joinlr($section1, $section2, $join, $results) +{ + global $sectionmap; + + $name1 = $sectionmap[$section1]; + $name2 = $sectionmap[$section2]; + $newres = array(); + + // foreach rig in section1 + foreach ($results[$name1] as $rig => $result) + { + $status = null; + + // foreach answer section in the rig api call + foreach ($result as $name1b => $fields1b) + { + if ($name1b == 'STATUS') + { + // remember the STATUS from section1 + $status = $result[$name1b]; + continue; + } + + // Build L string to be matched + $Lval = ''; + foreach ($join['L'] as $field) + $Lval .= join_get_field($field, $fields1b); + + // foreach answer section in the rig api call (for the other api command) + foreach ($results[$name2][$rig] as $name2b => $fields2b) + { + if ($name2b == 'STATUS') + continue; + + // Build R string and compare + $Rval = ''; + foreach ($join['R'] as $field) + $Rval .= join_get_field($field, $fields2b); + + if ($Lval === $Rval) + { + if ($status != null) + { + $newres[$rig]['STATUS'] = $status; + $status = null; + } + + $subsection = $section1.'+'.$section2; + $subsection .= preg_replace('/[^0-9]/', '', $name1b.$name2b); + + foreach ($fields1b as $nam => $val) + $newres[$rig][$subsection]["$section1.$nam"] = $val; + foreach ($fields2b as $nam => $val) + $newres[$rig][$subsection]["$section2.$nam"] = $val; + } + } + } + } + return $newres; +} +# +function joinall($section1, $section2, $results) +{ + global $sectionmap; + + $name1 = $sectionmap[$section1]; + $name2 = $sectionmap[$section2]; + $newres = array(); + + // foreach rig in section1 + foreach ($results[$name1] as $rig => $result) + { + // foreach answer section in the rig api call + foreach ($result as $name1b => $fields1b) + { + if ($name1b == 'STATUS') + { + // copy the STATUS from section1 + $newres[$rig][$name1b] = $result[$name1b]; + continue; + } + + // foreach answer section in the rig api call (for the other api command) + foreach ($results[$name2][$rig] as $name2b => $fields2b) + { + if ($name2b == 'STATUS') + continue; + + $subsection = $section1.'+'.$section2; + $subsection .= preg_replace('/[^0-9]/', '', $name1b.$name2b); + + foreach ($fields1b as $nam => $val) + $newres[$rig][$subsection]["$section1.$nam"] = $val; + foreach ($fields2b as $nam => $val) + $newres[$rig][$subsection]["$section2.$nam"] = $val; + } + } + } + return $newres; +} +# +function joinsections($sections, $results, $errors) +{ + global $sectionmap; + + // GPU's don't have Name,ID,ProcID fields - so create them + foreach ($results as $section => $res) + foreach ($res as $rig => $result) + foreach ($result as $name => $fields) + { + $subname = preg_replace('/[0-9]/', '', $name); + if ($subname == 'GPU' and isset($result[$name]['GPU'])) + { + $results[$section][$rig][$name]['Name'] = 'GPU'; + $results[$section][$rig][$name]['ID'] = $result[$name]['GPU']; + $results[$section][$rig][$name]['ProcID'] = 0; + } + } + + foreach ($sections as $section => $fields) + if ($section != 'DATE' && !isset($sectionmap[$section])) + { + $both = explode('+', $section, 2); + if (count($both) > 1) + { + switch($both[0]) + { + case 'SUMMARY': + switch($both[1]) + { + case 'POOL': + case 'DEVS': + case 'CONFIG': + case 'COIN': + $sectionmap[$section] = $section; + $results[$section] = joinall($both[0], $both[1], $results); + break; + default: + $errors[] = "Error: Invalid section '$section'"; + break; + } + break; + case 'DEVS': + switch($both[1]) + { + case 'NOTIFY': + case 'DEVDETAILS': + case 'USBSTATS': + $join = array('Name', 'ID', 'ProcID'); + $sectionmap[$section] = $section; + $results[$section] = joinfields($both[0], $both[1], $join, $results); + break; + case 'STATS': + $join = array('L' => array('Name','ID','ProcID'), 'R' => array('ID')); + $sectionmap[$section] = $section; + $results[$section] = joinlr($both[0], $both[1], $join, $results); + break; + default: + $errors[] = "Error: Invalid section '$section'"; + break; + } + break; + case 'POOL': + switch($both[1]) + { + case 'STATS': + $join = array('L' => array(':POOL','POOL'), 'R' => array('ID')); + $sectionmap[$section] = $section; + $results[$section] = joinlr($both[0], $both[1], $join, $results); + break; + default: + $errors[] = "Error: Invalid section '$section'"; + break; + } + break; + default: + $errors[] = "Error: Invalid section '$section'"; + break; + } + } + else + $errors[] = "Error: Invalid section '$section'"; + } + + return array($results, $errors); +} +# +function secmatch($section, $field) +{ + if ($section == $field) + return true; + + if ($section == 'DEVS' + && ($field == 'GPU' || $field == 'PGA')) + return true; + + return false; +} +# +function customset($showfields, $sum, $section, $rig, $isbutton, $result, $total) +{ + foreach ($result as $sec => $row) + { + $secname = preg_replace('/\d/', '', $sec); + + if ($sec != 'total') + if (!secmatch($section, $secname)) + continue; + + newrow(); + + $when = 0; + if (isset($result['STATUS']['When'])) + $when = $result['STATUS']['When']; + + + if ($isbutton) + echo rigbutton($rig, $rig, $when, $row); + else + { + list($ignore, $class) = fmt('total', '', '', $when, $row); + echo ""; + } + + foreach ($showfields as $name => $one) + { + if (isset($row[$name])) + { + $value = $row[$name]; + + if (isset($sum[$section][$name])) + { + if (isset($total[$name])) + $total[$name] += $value; + else + $total[$name] = $value; + } + } + else + { + if ($sec == 'total' && isset($total[$name])) + $value = $total[$name]; + else + $value = null; + } + + if (strpos($secname, '+') === false) + list($showvalue, $class) = fmt($secname, $name, $value, $when, $row); + else + { + $parts = explode('.', $name, 2); + list($showvalue, $class) = fmt($parts[0], $parts[1], $value, $when, $row); + } + + echo "$showvalue"; + } + endrow(); + } + return $total; +} +# +function docalc($func, $data) +{ + switch ($func) + { + case 'sum': + $tot = 0; + foreach ($data as $val) + $tot += $val; + return $tot; + case 'avg': + $tot = 0; + foreach ($data as $val) + $tot += $val; + return ($tot / count($data)); + case 'min': + $ans = null; + foreach ($data as $val) + if ($ans === null) + $ans = $val; + else + if ($val < $ans) + $ans = $val; + return $ans; + case 'max': + $ans = null; + foreach ($data as $val) + if ($ans === null) + $ans = $val; + else + if ($val > $ans) + $ans = $val; + return $ans; + case 'lo': + $ans = null; + foreach ($data as $val) + if ($ans === null) + $ans = $val; + else + if (strcasecmp($val, $ans) < 0) + $ans = $val; + return $ans; + case 'hi': + $ans = null; + foreach ($data as $val) + if ($ans === null) + $ans = $val; + else + if (strcasecmp($val, $ans) > 0) + $ans = $val; + return $ans; + case 'count': + return count($data); + case 'any': + default: + return $data[0]; + } +} +# +function docompare($row, $test) +{ + // invalid $test data means true + if (count($test) < 2) + return true; + + if (isset($row[$test[0]])) + $val = $row[$test[0]]; + else + $val = null; + + if ($test[1] == 'set') + return ($val !== null); + + if ($val === null || count($test) < 3) + return true; + + switch($test[1]) + { + case '=': + return ($val == $test[2]); + case '<': + return ($val < $test[2]); + case '<=': + return ($val <= $test[2]); + case '>': + return ($val > $test[2]); + case '>=': + return ($val >= $test[2]); + case 'eq': + return (strcasecmp($val, $test[2]) == 0); + case 'lt': + return (strcasecmp($val, $test[2]) < 0); + case 'le': + return (strcasecmp($val, $test[2]) <= 0); + case 'gt': + return (strcasecmp($val, $test[2]) > 0); + case 'ge': + return (strcasecmp($val, $test[2]) >= 0); + default: + return true; + } +} +# +function processcompare($which, $ext, $section, $res) +{ + if (isset($ext[$section][$which])) + { + $proc = $ext[$section][$which]; + if ($proc !== null) + { + $res2 = array(); + foreach ($res as $rig => $result) + foreach ($result as $sec => $row) + { + $secname = preg_replace('/\d/', '', $sec); + if (!secmatch($section, $secname)) + $res2[$rig][$sec] = $row; + else + { + $keep = true; + foreach ($proc as $test) + if (!docompare($row, $test)) + { + $keep = false; + break; + } + if ($keep) + $res2[$rig][$sec] = $row; + } + } + + $res = $res2; + } + } + return $res; +} +# +function ss($a, $b) +{ + $la = strlen($a); + $lb = strlen($b); + if ($la != $lb) + return $lb - $la; + return strcmp($a, $b); +} +# +function genfld($row, $calc) +{ + uksort($row, "ss"); + + foreach ($row as $name => $value) + if (strstr($calc, $name) !== FALSE) + $calc = str_replace($name, $value, $calc); + + eval("\$val = $calc;"); + + return $val; +} +# +function dogen($ext, $section, &$res, &$fields) +{ + $gen = $ext[$section]['gen']; + + foreach ($gen as $fld => $calc) + $fields[] = "GEN.$fld"; + + foreach ($res as $rig => $result) + foreach ($result as $sec => $row) + { + $secname = preg_replace('/\d/', '', $sec); + if (secmatch($section, $secname)) + foreach ($gen as $fld => $calc) + { + $name = "GEN.$fld"; + + $val = genfld($row, $calc); + + $res[$rig][$sec][$name] = $val; + } + } +} +# +function processext($ext, $section, $res, &$fields) +{ + global $allowgen; + + $res = processcompare('where', $ext, $section, $res); + + if (isset($ext[$section]['group'])) + { + $grp = $ext[$section]['group']; + $calc = $ext[$section]['calc']; + if ($grp !== null) + { + $interim = array(); + $res2 = array(); + $cou = 0; + foreach ($res as $rig => $result) + foreach ($result as $sec => $row) + { + $secname = preg_replace('/\d/', '', $sec); + if (!secmatch($section, $secname)) + { + // STATUS may be problematic ... + if (!isset($res2[$sec])) + $res2[$sec] = $row; + } + else + { + $grpkey = ''; + $newrow = array(); + foreach ($grp as $field) + { + if (isset($row[$field])) + { + $grpkey .= $row[$field].'.'; + $newrow[$field] = $row[$field]; + } + else + $grpkey .= '.'; + } + + if (!isset($interim[$grpkey])) + { + $interim[$grpkey]['grp'] = $newrow; + $interim[$grpkey]['sec'] = $secname.$cou; + $cou++; + } + + if ($calc !== null) + foreach ($calc as $field => $func) + { + if (!isset($interim[$grpkey]['cal'][$field])) + $interim[$grpkey]['cal'][$field] = array(); + $interim[$grpkey]['cal'][$field][] = $row[$field]; + } + } + } + + // Build the rest of $res2 from $interim + foreach ($interim as $rowkey => $row) + { + $key = $row['sec']; + foreach ($row['grp'] as $field => $value) + $res2[$key][$field] = $value; + foreach ($row['cal'] as $field => $data) + $res2[$key][$field] = docalc($calc[$field], $data); + } + + $res = array('' => $res2); + } + } + + // Generated fields (functions of other fields) + if ($allowgen === true && isset($ext[$section]['gen'])) + dogen($ext, $section, $res, $fields); + + return processcompare('having', $ext, $section, $res); +} +# +function processcustompage($pagename, $sections, $sum, $ext, $namemap) +{ + global $sectionmap; + global $miner, $port; + global $rigs, $error; + global $warnfont, $warnoff; + global $dfmt; + global $readonly, $showndate; + + $cmds = array(); + $errors = array(); + foreach ($sections as $section => $fields) + { + $all = explode('+', $section); + foreach ($all as $section) + { + if (isset($sectionmap[$section])) + { + $cmd = $sectionmap[$section]; + if (!isset($cmds[$cmd])) + $cmds[$cmd] = 1; + } + else + if ($section != 'DATE') + $errors[] = "Error: unknown section '$section' in custom summary page '$pagename'"; + } + } + + $results = array(); + foreach ($rigs as $num => $rig) + { + $parts = explode(':', $rig, 3); + if (count($parts) >= 2) + { + $miner = $parts[0]; + $port = $parts[1]; + + if (count($parts) > 2) + $name = $parts[2]; + else + $name = $rig; + + foreach ($cmds as $cmd => $one) + { + $process = api($name, $cmd); + + if ($error != null) + { + $errors[] = "Error getting $cmd for $name $warnfont$error$warnoff"; + break; + } + else + $results[$cmd][$num] = $process; + } + } + else + otherrow(''); + } + + $shownsomething = false; + if (count($results) > 0) + { + list($results, $errors) = joinsections($sections, $results, $errors); + $first = true; + foreach ($sections as $section => $fields) + { + if ($section === 'DATE') + { + if ($shownsomething) + otherrow(''); + + newtable(); + showdatetime(); + endtable(); + // On top of the next table + $shownsomething = false; + continue; + } + + if ($section === 'RIGS') + { + if ($shownsomething) + otherrow(''); + + newtable(); + showrigs($results['version'], 'Rig', ''); + endtable(); + $shownsomething = true; + continue; + } + + if (isset($results[$sectionmap[$section]])) + { + $rigresults = processext($ext, $section, $results[$sectionmap[$section]], $fields); + + $showfields = array(); + $showhead = array(); + foreach ($fields as $field) + foreach ($rigresults as $result) + foreach ($result as $sec => $row) + { + $secname = preg_replace('/\d/', '', $sec); + if (secmatch($section, $secname)) + { + if ($field === '*') + { + foreach ($row as $f => $v) + { + $showfields[$f] = 1; + $map = $section.'.'.$f; + if (isset($namemap[$map])) + $showhead[$namemap[$map]] = 1; + else + $showhead[$f] = 1; + } + } + elseif (isset($row[$field])) + { + $showfields[$field] = 1; + $map = $section.'.'.$field; + if (isset($namemap[$map])) + $showhead[$namemap[$map]] = 1; + else + $showhead[$field] = 1; + } + } + } + + if (count($showfields) > 0) + { + if ($shownsomething) + otherrow(''); + + newtable(); + if (count($rigresults) == 1 && isset($rigresults[''])) + $ri = array('' => 1) + $showhead; + else + $ri = array('Rig' => 1) + $showhead; + showhead('', $ri, true); + + $total = array(); + $add = array('total' => array()); + + foreach ($rigresults as $num => $result) + $total = customset($showfields, $sum, $section, $num, true, $result, $total); + + if (count($total) > 0) + customset($showfields, $sum, $section, 'Σ', false, $add, $total); + + $first = false; + + endtable(); + $shownsomething = true; + } + } + } + } + + if (count($errors) > 0) + { + if (count($results) > 0) + otherrow(''); + + foreach ($errors as $err) + otherrow(""); + } +} +# +function showcustompage($pagename) +{ + global $customsummarypages; + global $placebuttons; + + if ($placebuttons == 'top' || $placebuttons == 'both') + pagebuttons(null, $pagename); + + if (!isset($customsummarypages[$pagename])) + { + otherrow(""); + return; + } + + $c = count($customsummarypages[$pagename]); + if ($c < 2 || $c > 3) + { + $rw = "'; + otherrow($rw); + return; + } + + $page = $customsummarypages[$pagename][0]; + $namemap = array(); + foreach ($page as $name => $fields) + { + if ($fields === null) + $page[$name] = array(); + else + foreach ($fields as $num => $field) + { + $pos = strpos($field, '='); + if ($pos !== false) + { + $names = explode('=', $field, 2); + if (strlen($names[1]) > 0) + $namemap[$name.'.'.$names[0]] = $names[1]; + $page[$name][$num] = $names[0]; + } + } + } + + $ext = null; + if (isset($customsummarypages[$pagename][2])) + $ext = $customsummarypages[$pagename][2]; + + $sum = $customsummarypages[$pagename][1]; + if ($sum === null) + $sum = array(); + + // convert them to searchable via isset() + foreach ($sum as $section => $fields) + { + $newfields = array(); + foreach ($fields as $field) + $newfields[$field] = 1; + $sum[$section] = $newfields; + } + + if (count($page) <= 1) + { + otherrow(""); + return; + } + + processcustompage($pagename, $page, $sum, $ext, $namemap); + + if ($placebuttons == 'bot' || $placebuttons == 'both') + pagebuttons(null, $pagename); +} +# +function onlylogin() +{ + global $here; + + htmlhead('', false, null, null, true); + +?> + + +No rigs $action"); + return; + } + else + { + if ($mcast === true && count($rigs) < $mcastexpect) + $mcerr = othrow('"); + } + + if ($ignorerefresh == false) + { + $ref = trim(getparam('ref', true)); + if ($ref != null && $ref != '') + $autorefresh = intval($ref); + } + + if ($pagesonly !== true) + { + $rig = trim(getparam('rig', true)); + + $arg = trim(getparam('arg', true)); + $preprocess = null; + if ($arg != null and $arg != '') + { + if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) + { + $parts = explode(':', $rigs[$rig], 3); + if (count($parts) >= 2) + { + $miner = $parts[0]; + $port = $parts[1]; + + if ($readonly !== true) + $preprocess = $arg; + } + } + } + } + + if ($allowcustompages === true) + { + $pg = urlencode(trim(getparam('pg', true))); + if ($pagesonly === true) + { + if ($pg !== null && $pg !== '') + { + if ($userlist !== null && isset($userlist['def']) + && !in_array($pg, $userlist['def'])) + $pg = null; + } + else + { + if ($userlist !== null && isset($userlist['def'])) + foreach ($userlist['def'] as $pglook) + if (isset($customsummarypages[$pglook])) + { + $pg = $pglook; + break; + } + } + } + + if ($pg !== null && $pg !== '') + { + htmlhead($mcerr, false, null, $pg); + showcustompage($pg, $mcerr); + return; + } + } + + if ($pagesonly === true) + { + onlylogin(); + return; + } + + if (count($rigs) == 1) + { + $parts = explode(':', $rigs[0], 3); + if (count($parts) >= 2) + { + $miner = $parts[0]; + $port = $parts[1]; + + htmlhead($mcerr, true, 0); + doOne(0, $preprocess); + } + else + { + minhead($mcerr); + otherrow(''); + } + + return; + } + + if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) + { + $parts = explode(':', $rigs[$rig], 3); + if (count($parts) >= 2) + { + $miner = $parts[0]; + $port = $parts[1]; + + htmlhead($mcerr, true, 0); + doOne($rig, $preprocess); + } + else + { + minhead($mcerr); + otherrow(''); + } + + return; + } + + htmlhead($mcerr, false, null); + + if ($placebuttons == 'top' || $placebuttons == 'both') + pagebuttons(null, null); + + if ($preprocess != null) + process(array($preprocess => $preprocess), $rig); + + newtable(); + doforeach('version', 'rig summary', array(), array(), true); + $sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH'); + doforeach('summary', 'summary information', $sum, array(), false); + endtable(); + otherrow(''); + newtable(); + doforeach('devs', 'device list', $sum, array(''=>'','ProcID'=>'','ID'=>'','Name'=>''), false); + endtable(); + otherrow(''); + newtable(); + doforeach('pools', 'pool list', $sum, array(''=>''), false); + endtable(); + + if ($placebuttons == 'bot' || $placebuttons == 'both') + pagebuttons(null, null); +} +# +if ($mcast === true) + getrigs(); +display(); +# +?> +
$name$nameDate: '.date($dfmt).'Computer: '.$list['STATUS']['Description'].'When: '.date($dfmt, $list['STATUS']['When']).'Status: '.$stas[$sta].'Message: '.$list['STATUS']['Msg'].'$head$desError getting GPU count: $warnfont$error$warnoffNo GPU count returned: '.$warnfont; + $rw .= $gpus['STATUS']['STATUS'].' '.$gpus['STATUS']['Msg']; + $rw .= $warnoff.'No GPUs Add a pool: "; + + foreach ($inps as $text => $name) + echo "$text: "; + + echo " Set pool priorities: Comma list of pool numbers: "; + echo "Error getting $des: $warnfont$error$warnoff

$riError on rig $name getting "; + $rw .= "$des: $warnfont$error$warnoffFailed to access any rigs successfully'; + if ($preverr > 0) + $rw .= ' (or rigs had previous errors)'; + $rw .= '

Total:
'; + if ($userlist === null || isset($_SESSION[$ses])) + { + if ($prev !== null) + echo riginput($prev, 'Prev').' '; + echo " "; + if ($next !== null) + echo riginput($next, 'Next').' '; + echo ' '; + if (count($rigs) > 1) + echo " "; + } + + if ($allowcustompages === true) + { + if ($userlist === null || isset($_SESSION[$ses])) + $list = $customsummarypages; + else + { + if ($userlist !== null && isset($userlist['def'])) + $list = array_flip($userlist['def']); + else + $list = array(); + } + + foreach ($list as $pagename => $data) + echo " "; + } + + echo ' '; + if ($rig !== null && $readonly === false) + { + $rg = ''; + if (count($rigs) > 1) + $rg = " Rig $rig"; + echo ""; + echo " "; + } + refreshbuttons(); + if (isset($_SESSION[$ses])) + echo " "; + else + if ($userlist !== null) + echo " "; + + echo "
$rigBad "$rigs" array    $errUnknown custom summary page '$pagename'Invalid custom summary page '$pagename' ("; + $rw .= count($customsummarypages[$pagename]).')Invalid custom summary page '$pagename' no content
 
+
+ + +
+ + +
+ + + + + + + + +
 
+

LOGIN

Username:
+
Password:
+
+
+
Found '.count($rigs)." rigs but expected at least $mcastexpectInvalid "$rigs" arrayInvalid "$rigs" array



+