src/treesutil.c
/**
 * generate user data from hex strings
 */
generate user data from hex strings
generate user data from hex strings
static void
unhexuser(user_t *user)
{
    if(sodium_hex2bin(user->pubkey, sizeof user->pubkey,
                      user->pubkeystr, strlen(user->pubkeystr), NULL, NULL, NULL) != 0)
        die(false, "invalid publickey hex");
    if(sodium_hex2bin(user->salt, sizeof user->salt,
                      user->saltstr, strlen(user->saltstr), NULL, NULL, NULL) != 0)
        die(false, "invalid salt hex");
    if(sodium_hex2bin(user->nonce, sizeof user->nonce,
                      user->noncestr, strlen(user->noncestr), NULL, NULL, NULL) != 0)
        die(false, "invalid nonce hex");
    if(sodium_hex2bin(user->locked, sizeof user->locked,
                      user->lockedstr, strlen(user->lockedstr), NULL, NULL, NULL) != 0)
        die(false, "invalid locked box hex");
    if(VERBOSE) {
        fputs("making user from hex\n", stderr);
        fprintf(stderr, "public: ");
        print_debug_hex(user->pubkey, sizeof user->pubkey);
        fprintf(stderr, "salt: ");
        print_debug_hex(user->salt, sizeof user->salt);
        fprintf(stderr, "nonce: ");
        print_debug_hex(user->nonce, sizeof user->nonce);
        fprintf(stderr, "locked: ");
        print_debug_hex(user->locked, sizeof user->locked);
    }
}
static void unhexuser ( user_t * user ) { if ( sodium_hex2bin ( user -> pubkey , sizeof user -> pubkey , user -> pubkeystr , strlen ( user -> pubkeystr ) , NULL , NULL , NULL ) != 0 ) die ( false , " " ) ; if ( sodium_hex2bin ( user -> salt , sizeof user -> salt , user -> saltstr , strlen ( user -> saltstr ) , NULL , NULL , NULL ) != 0 ) die ( false , " " ) ; if ( sodium_hex2bin ( user -> nonce , sizeof user -> nonce , user -> noncestr , strlen ( user -> noncestr ) , NULL , NULL , NULL ) != 0 ) die ( false , " " ) ; if ( sodium_hex2bin ( user -> locked , sizeof user -> locked , user -> lockedstr , strlen ( user -> lockedstr ) , NULL , NULL , NULL ) != 0 ) die ( false , " " ) ; if ( VERBOSE ) { fputs ( " \n " , stderr ) ; fprintf ( stderr , " " ) ; print_debug_hex ( user -> pubkey , sizeof user -> pubkey ) ; fprintf ( stderr , " " ) ; print_debug_hex ( user -> salt , sizeof user -> salt ) ; fprintf ( stderr , " " ) ; print_debug_hex ( user -> nonce , sizeof user -> nonce ) ; fprintf ( stderr , " " ) ; print_debug_hex ( user -> locked , sizeof user -> locked ) ; } }
generate user data from hex strings
generate user data from hex strings