Bitcoin Forum
June 21, 2024, 10:13:24 PM *
News: Voting for pizza day contest
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 »
1  Alternate cryptocurrencies / Altcoin Discussion / Wallet encryption on: May 20, 2017, 08:47:36 PM
I been looking at NEM coins community wallet program to try and figure out how the wallets are encrypted. I found this code in the source and it appears to be were it encrypts the wallet. Can somebody explain to me how the code is encrypting the wallet? To me it appears to do multiple rounds, but I'm not sure how it determines the amount of rounds. The entire source can be found at

https://github.com/NemProject/NemCommunityClient/archive/v0.6.31.zip


Code:
package org.nem.console.utils;

import org.apache.commons.io.IOUtils;
import org.bouncycastle.crypto.engines.AESEngine;
import org.bouncycastle.crypto.io.*;
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;
import org.bouncycastle.crypto.params.*;
import org.nem.core.crypto.Hashes;
import org.nem.core.utils.*;

import java.io.*;

/**
 * Helper class for reading and writing encrypted data.
 */
class EncryptedInputOutput {
private static final int BLOCK_SIZE = 16;

private final String password;
private final int numHashes;

/**
* Creates a new encrypted input / output object.
*
* @param password The password.
* @param numHashes The number of hashes.
*/
public EncryptedInputOutput(final String password, final int numHashes) {
this.password = password;
this.numHashes = numHashes;

if (StringUtils.isNullOrEmpty(this.password)) {
throw new IllegalArgumentException("password cannot be empty");
}

if (this.numHashes < 1) {
throw new IllegalArgumentException("password must be hashed at least once");
}
}

/**
* Writes a blob of data to the specified encrypted file.
*
* @param fileName The file to which to write.
* @param data The plain data.
*/
public void writeTo(final String fileName, final byte[] data) {
ExceptionUtils.propagateVoid(
() -> this.writeToInternal(fileName, data),
ex -> new StorageException(String.format("writing to '%s' failed", fileName), ex));
}

private void writeToInternal(final String fileName, final byte[] data) throws IOException {
FileMust.notExist(fileName); // TODO: this doesn't belong here

try (final OutputStream outputStream = new FileOutputStream(fileName)) {
final PaddedBufferedBlockCipher cipher = this.getCipher(true);
try (final CipherOutputStream cos = new CipherOutputStream(outputStream, cipher)) {
cos.write(data);
}
}
}

/**
* Reads a block of blob from data to the specified encrypted file.
*
* @param fileName The file to which to write.
* @return The data.
*/
public byte[] readFrom(final String fileName) {
return ExceptionUtils.propagate(
() -> this.readFromInternal(fileName),
ex -> new StorageException(String.format("reading from '%s' failed", fileName), ex));
}

private byte[] readFromInternal(final String fileName) throws IOException {
FileMust.exist(fileName); // TODO: this doesn't belong here

final PaddedBufferedBlockCipher cipher = this.getCipher(false);
try (final InputStream inputStream = new FileInputStream(fileName)) {
try (final CipherInputStream cis = new CipherInputStream(inputStream, cipher)) {
return IOUtils.toByteArray(cis);
}
}
}

private PaddedBufferedBlockCipher getCipher(final boolean encrypt) {
byte[] hash = Hashes.sha3_256(StringEncoder.getBytes(this.password));
for (int i = 0; i < this.numHashes - 1; ++i) {
hash = Hashes.sha3_256(hash);
}

final KeyParameter key = new KeyParameter(hash);

// create and initialize the cipher
final PaddedBufferedBlockCipher resultCipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine()));
final ParametersWithIV parameterIV = new ParametersWithIV(key, new byte[BLOCK_SIZE]);
resultCipher.init(encrypt, parameterIV);
return resultCipher;
}
}
2  Other / Beginners & Help / Re: Help needed with cgminer on: March 11, 2014, 10:14:59 AM
Here's an update of my problem I'm having with cgminer. I thought for the heck of it I would see if cgminer would compile other kernels and it does, every one except scrypt. I used GPU caps viewer to see if opencl was working it runs all the demos for opencl. The luxmark-win64-v2.0 benchmark also runs fine. So at this point I assume opencl is installed and working correctly? Anybody have any thoughts?


This is the config I'm using
Code:
{
"pools" : [
{
"url" : "http://stratum.give-me-coins.com:3333",
"user" : "ifowler46.5",
"pass" : "LTC"
}
]
,
"intensity" : "1",
"vectors" : "1",
"worksize" : "256",
"kernel" : "scrypt",
"lookup-gap" : "0",
"gpu-engine" : "0-0",
"gpu-fan" : "100",
"gpu-memclock" : "0",
"gpu-memdiff" : "0",
"gpu-powertune" : "0",
"gpu-vddc" : "0.000",
"temp-cutoff" : "95",
"temp-overheat" : "85",
"temp-target" : "75",
"api-port" : "4028",
"expiry" : "120",
"gpu-dyninterval" : "7",
"gpu-platform" : "0",
"gpu-threads" : "2",
"hotplug" : "5",
"log" : "5",
"no-pool-disable" : true,
"queue" : "1",
"scan-time" : "60",
"temp-hysteresis" : "3",
"shares" : "0",
"kernel-path" : "/usr/local/bin"
}




3  Bitcoin / Mining software (miners) / Re: Radeon 7850 and 4850 working together on: March 09, 2014, 03:07:03 AM
I been having a hard time getting my 4850 mining at all. Have you got it to mine at all?
4  Other / Archival / Re: FREE microwallet faucet bitcoin Hi2w.com HiToWorld Earn upto 1000 satoshi HOURLY on: March 08, 2014, 06:53:06 AM
Seems rough redirected me as soon as the page loaded.
5  Other / Beginners & Help / Re: Help needed with cgminer on: March 08, 2014, 06:42:34 AM
Yeah that's what I thought. This card is really stumping me maybe because its a 4000 series?


Are you using version 3.7.2?

I have tried these with the same results
2.11.4
2.11.2
3.2.0
3.7.2

I also tried different versions of bfgminer same thing happens just sits hung up using 100% of a cpu core.
6  Other / Beginners & Help / Re: Help needed with cgminer on: March 08, 2014, 06:34:14 AM
Not on scrypt the bitminter program works fine.  I download a fresh copy of cgminer and ran cgminer.exe --scrypt and entered the pool info. Is that starting with no settings? If i run cgminer.exe it seems to use the sha256 kernal and reports hash rate in MH/s.



It will stay like this with no gpu load
7  Other / Beginners & Help / Help needed with cgminer on: March 08, 2014, 06:15:14 AM
I been spending hours trying to get a HD4850 mining scrypt coins. Thought I would see if anybody could help me. This is the command i have try to start cgminer with.

Code:
--scrypt -T -o stratum+tcp://xxxxx.xxx -u xxxxxx -pxxxxxx --thread-concurrency 400 -I 10 -g 2 -w 128

It will just sit at setting pool difficulty. I change thread-concurrency from 400-3000, -g 1 and -g 2, I have also changed the worksize to 256. Nothing seems to work. I'm using the 13-9-legacy_vista_win7_64_dd_ccc_whql driver with the AMD-APP-SDK-v2.7-Windows-64. If i don't install the sdk opencl is not installed on the system. I've done multiple uninstalls of drivers and re-installs. Gpu-z and furmark both see opencl after the SDK. The bitminter program will mine as long as opencl is install but cgminer sits there stalled.

I have tried starting cgminer with

cgminer.exe --scrypt

and enter pool info. After hitting enter after the password it will just sit there doing nothing. I try using text only (-T)same thing.

Ian


EDIT: Turns out re-installing windows 7 and installing the driver fixed the issues that I was having. I used the latest driver for the card 13-9-legacy_vista_win7_64_dd_ccc_whql.exe
8  Economy / Computer hardware / Re: [WTS] XFX Ghost 7870 Core Edition on: March 05, 2014, 02:06:54 PM
What are the temps your getting with the card? I bought the double fan version and the cooling on them was so bad i had to get aftermarket coolers for them.
9  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] NEM :: descendant of NXT - 4 billion coins on: January 22, 2014, 01:03:36 AM
Interested and paid:

867af55bbcc836b3ffa78b4ee09982c8126ad2c93e2edb8c031be999f6ebd211
https://blockchain.info/tx/867af55bbcc836b3ffa78b4ee09982c8126ad2c93e2edb8c031be999f6ebd211
10  Alternate cryptocurrencies / Altcoin Discussion / Re: [GIVEAWAY] CoinyeCasino - CoinyeCoin giveaway! on: January 10, 2014, 11:10:21 AM
5gcWkeKhSkGKhECRKLARrrnZukK2JmUqjn

thanks
11  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN][COYE] Coinye Coin - Launch: JANUARY 7, 2014. 7 PM PST on: January 09, 2014, 02:37:54 AM
200 mh, , growing fast!!!!   BECOME RICHFISH TODAY!!!!

ALL TIME EARNINGS AT
106% OF EXPECTED =))(94% expected shares on average per block!!!!)  LONG HISTORY WITH LTC/DOGE --- Millions of USD in cryptos paid out.  Why risk it with an unproven/unknown pool?

https://coinye.netcodepool.org/




Been using this pool and been hashing away all night and day. Grin Wasn't able to mine at release because many of the pools I started with were nonfunctional.
12  Economy / Computer hardware / Re: [FS]LiteCoin Mining Rig or trade on: November 18, 2013, 11:29:16 PM
$300?
13  Economy / Computer hardware / Re: [FS]LiteCoin Mining Rig or trade on: November 18, 2013, 06:38:02 PM
What temps are these cards running at?
14  Economy / Computer hardware / Re: [FS]LiteCoin Mining Rig or trade on: November 18, 2013, 05:06:21 AM
I bid $200
15  Alternate cryptocurrencies / Altcoin Discussion / Re: ScryptMiner GUI - Simple GUI for Litecoin mining on: November 05, 2013, 02:27:42 AM
is this still working?

Yes, just slow because its CPU only.

16  Economy / Computer hardware / Re: [WTB] Waterblock for Radeon HD 5970 on: October 19, 2013, 01:26:58 AM
Ok I'll take 2.  Grin 
17  Economy / Computer hardware / [WTB] Waterblock for Radeon HD 5970 on: October 18, 2013, 04:51:48 AM
Was wonder if anybody had a spare waterblock for a 5970 lying around. I live in the United States.
18  Other / Beginners & Help / Re: Get .0005 BTC Free ...Help my Daughter Win A Contest on: August 23, 2013, 06:15:00 PM
Voted twice as well.


17Y6CVZnWWb6XkVBnEQYNKgeg63AJ5wpKQ
19  Other / Beginners & Help / Re: I need moneypak will escrow on localbitcoins on: August 22, 2013, 01:00:52 AM
I didn't say you were not legit, but there was a virus going around that asked people to enter a $200 moneypak to unlock there computers. I was trying to save you some $$ if that was the case.
20  Other / Beginners & Help / Re: I need moneypak will escrow on localbitcoins on: August 22, 2013, 12:47:49 AM
It doesn't happen to be the FBI virus asking for it?
Pages: [1] 2 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!