<commit_before>//
//  BRCryptoAccount.c
//  BRCore
//
//  Created by <NAME> on 3/19/19.
//  Copyright © 2019 breadwallet. All rights reserved.
//
//  See the LICENSE file at the project root for license information.
//  See the CONTRIBUTORS file at the project root for a list of contributors.

#include <pthread.h>

#include "BRCryptoAccount.h"
#include "BRCryptoPrivate.h"

#include "support/BRBIP32Sequence.h"
#include "support/BRBIP39Mnemonic.h"
#include "support/BRKey.h"
#include "ethereum/BREthereum.h"
#include "generic/BRGenericRipple.h"

static pthread_once_t  _accounts_once = PTHREAD_ONCE_INIT;

#include "generic/BRGenericHandlers.h"

static void _accounts_init (void) {
    genHandlersInstall (genericRippleHandlers);
    // ...
}

static uint16_t
checksumFletcher16 (const uint8_t *data, size_t count);

static void
randomBytes (void *bytes, size_t bytesCount);

#define ACCOUNT_SERIALIZE_DEFAULT_VERSION  1

static void
cryptoAccountRelease (BRCryptoAccount account);

struct BRCryptoAccountRecord {
    BRMasterPubKey btc;
    BREthereumAccount eth;
    BRGenericAccount xrp;
    // ...

    uint64_t timestamp;
    BRCryptoRef ref;
};

IMPLEMENT_CRYPTO_GIVE_TAKE (BRCryptoAccount, cryptoAccount);

static UInt512
cryptoAccountDeriveSeedInternal (const char *phrase) {
    UInt512 seed;
    BRBIP39DeriveKey (seed.u8, phrase, NULL);
    return seed;
}

extern UInt512
cryptoAccountDeriveSeed (const char *phrase) {<commit_msg>CORE-692: Update BRCryptoAccount version (for ripple)<commit_after>//
//  BRCryptoAccount.c
//  BRCore
//
//  Created by <NAME> on 3/19/19.
//  Copyright © 2019 breadwallet. All rights reserved.
//
//  See the LICENSE file at the project root for license information.
//  See the CONTRIBUTORS file at the project root for a list of contributors.

#include <pthread.h>

#include "BRCryptoAccount.h"
#include "BRCryptoPrivate.h"

#include "support/BRBIP32Sequence.h"
#include "support/BRBIP39Mnemonic.h"
#include "support/BRKey.h"
#include "ethereum/BREthereum.h"
#include "generic/BRGenericRipple.h"

static pthread_once_t  _accounts_once = PTHREAD_ONCE_INIT;

#include "generic/BRGenericHandlers.h"

static void _accounts_init (void) {
    genHandlersInstall (genericRippleHandlers);
    // ...
}

static uint16_t
checksumFletcher16 (const uint8_t *data, size_t count);

static void
randomBytes (void *bytes, size_t bytesCount);

// Version 1: BTC (w/ BCH), ETH
// Version 2: BTC (w/ BCH), ETH, XRP
#define ACCOUNT_SERIALIZE_DEFAULT_VERSION  2

static void
cryptoAccountRelease (BRCryptoAccount account);

struct BRCryptoAccountRecord {
    BRMasterPubKey btc;
    BREthereumAccount eth;
    BRGenericAccount xrp;
    // ...

    uint64_t timestamp;
    BRCryptoRef ref;
};

IMPLEMENT_CRYPTO_GIVE_TAKE (BRCryptoAccount, cryptoAccount);

static UInt512
cryptoAccountDeriveSeedInternal (const char *phrase) {
    UInt512 seed;
    BRBIP39DeriveKey (seed.u8, phrase, NULL);
    return seed;
}

extern UInt512
cryptoAccountDeriveSeed (const char *phrase) {
{'fraction_non_alphanumeric': 0.09716193656093489, 'fraction_numerical': 0.02370617696160267, 'mean_word_length': 4.407942238267148, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5866429', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1014, 'n_words': 268}