sha256 – How to generate the public key hash in Bitcoin

I try to hash the public key SHA256 and then ripemed160 and get the hash. but there is a mistake System.ArgumentOutOfRangeException: 'Index and length must refer to a location within the string. Parameter name: length'
Why this?

Public key: 2b4632d08485ff1df2db55b9dafd23347d1c47a457072a1e87be26896549a8737

Hash should be: 93ce48570b55c42c2af816aeaba06cfee1224fae

Private Function HexStringToByteArray(ByVal shex As String) As Byte()
    Dim B As Byte() = Enumerable.Range(0, shex.Length).Where(Function(x) x Mod 2 = 0).(Select)(Function(x) Convert.ToByte(shex.Substring(x, 2), 16)).ToArray()
    Return Enumerable.Range(0, shex.Length).Where(Function(x) x Mod 2 = 0).(Select)(Function(x) Convert.ToByte(shex.Substring(x, 2), 16)).ToArray()
End Function


Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click

Dim public_key as String = "2b4632d08485ff1df2db55b9dafd23347d1c47a457072a1e87be26896549a8737"
    Dim pubkey_hash As String

    Dim sha256 As SHA256 = SHA256Managed.Create()

    Dim bytes As Byte() = HexStringToByteArray(public_key)
    Dim hash As Byte() = sha256.ComputeHash(bytes)
    Dim stringBuilder1 As New StringBuilder()

    For i As Integer = 0 To hash.Length - 1
        stringBuilder1.Append(hash(i).ToString("X2"))
    Next

    Dim ripemed160 As RIPEMD160 = RIPEMD160Managed.Create()

    bytes = HexStringToByteArray(stringBuilder1.ToString())
    hash = ripemed160.ComputeHash(bytes)

    Dim stringBuilder2 As New StringBuilder()

    For i As Integer = 0 To hash.Length - 1
        stringBuilder2.Append(hash(i).ToString("X2"))
    Next



    Dim arr() As Char = stringBuilder2.ToString.ToCharArray()

    Dim LE As String = ""
    Dim LE2 As String = ""

    Dim items_length As Integer = 0
    Dim itemcount As Integer = 0

    For Each item In arr
        itemcount += 1
        items_length += 1


        LE &= item.ToString

        If itemcount = 2 Then
            itemcount = 0

            LE2 = LE2.Insert(0, LE)

            LE = ""
        End If

        If items_length = arr.Length Then
            LE2 = LE2.Insert(0, LE)
        End If


    Next

    pubkey_hash = LE2
    TextBox14.Text = pubkey_hash

End Sub

and is there any way to shorten this code? Loops & if statements etc.

wifi – Public network cannot be found if it is another, password-protected network

I have a strange problem with my 2019 MBP: it cannot scan / detect a public network XYZif there is another XYZ Network that is password protected.

Practical example: When I go to a Starbucks, I know that there are two networks:

  • Publicity Starbuckswhere clients can connect
  • a WPA2 protected Starbucks Network (most likely used by its employees?)

Now I can see both networks with my Samsung smartphone and my work laptop and connect to the public Starbucks a.

However, my MPB is unable to find Starbucks public WiFi at all and only displays the password-protected one.

What can I do to fix this strange problem?

Public transport – where exactly can you go with a single ticket in Berlin?

Inspired by this question about the British overland railway.

In Berlin there is a single ticket for: "a single trip towards your destination", change "as often as necessary" for 120 minutes / change to trains / buses (stopping in the middle and then getting back on is expressly permitted). provided it is within this time window). The ticket records your origin, but not your destination. Tickets are "randomly" checked by plain-clothes inspectors.

How can I determine which routes I can take?

Here is a U-Bahn / S-Bahn map for reference. I am not allowed to reproduce the map here.

  1. Suppose I'm at wedding (top middle of the middle zone) and I want to go Tempelhof (lower middle of the middle zone). I can take the U6 line (purple) that cuts through the middle of the map. No changes are required.

    Alternatively, I can take the ring line (brown lines) in both directions. Both directions look about the same length. No changes are required. Are these routes allowed?

  2. Suppose I'm back at Wedding and I want to go Innsbrucker Platz (3 stops to the left of Tempelhof). The smallest number of changes required is 0 (take ring). If I take the U6 to Tempelhof and then the ring train to Innsbrucker Platz, I might get to Innsbrucker Platz earlier, but this route includes a change of train that is not necessary. Is this route allowed?

  3. If "unnecessary" train changes are allowed, is there a limit? Can I get from the wedding to Innsbrucker Platz via wedding -> Stadtmitte -> Potsdamer Platz -> Yorckstr -> Bayerischer Platz -> Innsbrucker Platz? (4 changes if 0 were enough)

Security – relationship between Bitcoin address and public key

I'm trying to understand the relationship between your public key and the bitcoin address. After reading some blogs, my understanding was that after generating your master key pair in HD wallet. You shouldn't share any part of it (neither publicly nor privately), but create child keys and use these child key pairs to create an address, but later when reading Atmoic Wallet, you came across the following

Now confused: do you have to share the public key? It's not a data protection risk. I thought you would create unique addresses for every transaction and avoid data loss.

ps. noob in BlockChain and Bitcoin

Switzerland – Does SBB's EasyBide work with public transport in Basel Stadt and Basel Landschaft?

The Swiss railway company SBB has something like EasyRide in the SBB Android app. You step into a kind of transit, switch it on and off again at the end of your trip. Then the cheapest ticket for your trip will be determined and billed to you (e.g. from your credit card).

I assume that this works with trains in and around Basel, but does it also work with other public transport in Basel? Can I use it on trams and buses?

Programming languages ​​- Have the inventors of Java ever expressed public regret about hash code and equality in the Object class?

I recently spoke to a colleague about hashCode and is synonymous with methods in the Object class in Java (among others). I have a more theoretical background, while my colleague is more of a pragmatic person.

In my opinion it makes no sense if the hashCode and the methods are defined in the Object class. While our personal discussion was quite amusing, I'm more interested in an official retrospective of the original Java inventors on the subject. Have you ever publicly regretted making the decision? Or have they all explicitly defended their decision against public criticism?

Public statements by people other than the original developers are also welcome, but only by people with at least some level of authority and publicity.

Thank you in advance!

Blockchain – hash graph public ledger (51% attack)

I have some basic doubts about consensus algorithms like hash graph. Let's take Raft, for example, as the simplest leader-based consensus algorithm. We cannot use it in a decentralized environment because it is very easy for a single attacker to take control of the cluster by spinning thousands of nodes to support it.

"In summary, the voting-based algorithm makes it very easy for the attacker to be leader-based or leaderless, so we can't use it in a decentralized environment."

Algos like PoW make it difficult for a single attacker to take over the network through the computing puzzle.

The hash graph is again a voting-based algorithm. So you're wondering how it prevents a single attacker from gaining control of the network in a decentralized environment (where you can't trust your peers).

I understand how hash graph works, but couldn't visualize it in a decentralized environment. Any insights? Thank you very much

bip 32 hd wallets – How can I derive a key from a 130-character public hex key?

I am working with a hardware wallet (keycard) and can use a 130-character public hex key with path m / 44 & # 39; / 0 & # 39; / 0 & # 39; export. Now I need to do an account discovery, and to do that I first need to get addresses of public keys that were obtained as explained here:

Generate HD addresses with publicKey Bip44

The problem is that I don't have an xpub. How can i after deriving the key for m / 44 & # 39; / 0 & # 39; / 0 & # 39; Derive public key for m / 0 / 0-19? I only started working with this stuff a few days ago and I'm a little confused.

sharepoint online – No public function is found by clicking the SPFx JQuery Dialog button

I am new to TypeScript and SPFx development.

I have a jquery UI dialog box and a public function in the same class that makes some MSGRAPH calls after the button is clicked.

The button click returns with an error:

this.addAlert is not a function

I think the problem is that the dialog code runs outside of the web part context and therefore doesn't know about the functionality available in the web part context.

How do I click the button to run in the web part context?

Here is the dialog code.

    public render(): void {

    this.domElement.innerHTML = AlertTemplate.templateHtml;
    const dialogOptions: JQueryUI.DialogOptions = {
      width: "50%",
      height: "auto",
      buttons: {
        "Subscribe": function (e) {
          this.addAlert("Yes");
          jQuery(this).dialog("close");
        },
        "No Thanks": function (e) {
          console.log("moo");
          this.addAlert("No");
          jQuery(this).dialog("close");
        },
        "Ask me later": function (e) {
          this.addAlert("Ask Me Later");
          jQuery(this).dialog("close");
        }
      }
    };

    jQuery('.dialog', this.domElement).dialog(dialogOptions);
    jQuery(".ui-dialog-titlebar").hide();
  }

AddAlert function

public addAlert(status: string): void {
var url = "/sites/" + this.context.pageContext.site.id + "/lists";
var listId = "";
var email = this.getCurrentUserEmail();
var recordExists = false;
let item: SubscriptionListItem;
this.context.msGraphClientFactory
  .getClient()
  .then((client: MSGraphClient): void => {
    client
      .api(url)
      .top(1)
      .filter("equals=(displayName, 'Subscriptions'")
      .version("v1.0")
      .get((err, res) => {
        if (err) {
          console.error(err);
          return;
        }
        console.log(res);
        listId = res.id;
      });
  });