AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Delphi C to Delphi: validate Bitcoin wallet address
Thema durchsuchen
Ansicht
Themen-Optionen

C to Delphi: validate Bitcoin wallet address

Ein Thema von flashcoder · begonnen am 25. Sep 2017 · letzter Beitrag vom 25. Sep 2017
Antwort Antwort
flashcoder

Registriert seit: 10. Nov 2013
83 Beiträge
 
#1

C to Delphi: validate Bitcoin wallet address

  Alt 25. Sep 2017, 01:07
I'm trying convert a C code that is able to validate a Bitcoin wallet address and is be very hard because i not know much about C language.

Here is C code used as reference and below is point until where i'm able to make.

So, someone could help me?


Code:
{$APPTYPE CONSOLE}
{$R *.res}

uses
  SysUtils;

const
  TMPL = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
  SHA256_DIGEST_LENGTH = 32;

function UnBase58(S: PWideChar; Outter: Byte): Integer;
var
  I, J: Integer;
  C: Extended;
  P: PWideChar;
begin
  Result := 0;
  FillChar(Outter, 0, 25);

  for I := 0 to Length(S) do
  begin
    P := StrPos(PWideChar(TMPL), PWideChar(S[I]));

    if P = nil then
      Exit;

    C := P - PWideChar(TMPL);
    for J := 25 downto 0 do
    begin
      C := C + 58 * Outter[J];
      Outter[J] := C mod 256;
      C := C / 256;
    end;

    // if C then Exit;

  end;

  Result := 1;
end;

function Valid(S: PWideChar): Integer;
var
 d, d1, d2: array[0..SHA256_DIGEST_LENGTH] of Byte;
begin
    if UnBase58(S, d) = 0 then Exit;

    ...

end;

Geändert von flashcoder (25. Sep 2017 um 01:15 Uhr)
  Mit Zitat antworten Zitat
SProske

Registriert seit: 16. Feb 2015
Ort: Halle/S.
116 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#2

AW: C to Delphi: validate Bitcoin wallet address

  Alt 25. Sep 2017, 08:09
Crosspost: https://stackoverflow.com/questions/...wallet-address
Sebastian
  Mit Zitat antworten Zitat
flashcoder

Registriert seit: 10. Nov 2013
83 Beiträge
 
#3

AW: C to Delphi: validate Bitcoin wallet address

  Alt 25. Sep 2017, 13:32
Yes, was solved, thank you by answer friend.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:47 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz