8000 GitHub - MrWiZoX15/SpigotLoader-KT: Download Spigot and inject into jvm
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MrWiZoX15/SpigotLoader-KT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpigotLoader-KT

To create a SHA-256 checksum file for spigot.jar, you can use a variety of tools. Here's a step-by-step guide on how to do it using command line tools.

Option 1: Using sha256sum (Linux/macOS)

  1. Open Terminal.
  2. Navigate to the directory where spigot.jar is located:
    cd /path/to/spigot.jar
  3. Generate the SHA-256 checksum and save it to a file:
    sha256sum spigot.jar > spigot.jar.sha256

This command generates the checksum and redirects it to spigot.jar.sha256.

Option 2: Using shasum -a 256 (macOS/BSD)

  1. Open Terminal.
  2. Navigate to the directory where spigot.jar is located:
    cd /path/to/spigot.jar
  3. Generate the SHA-256 checksum and save it to a file:
    shasum -a 256 spigot.jar > spigot.jar.sha256

Option 3: Using PowerShell (Windows)

  1. Open PowerShell.
  2. Navigate to the directory where spigot.jar is located:
    cd C:\path\to\spigot.jar
  3. Generate the SHA-256 checksum and save it to a file:
    Get-FileHash spigot.jar -Algorithm SHA256 | Format-List | Out-File spigot.jar.sha256

Option 4: Using Java

If you prefer using Java to generate the checksum, you can write a small Java program:

Save this code as GenerateChecksum.java:

import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Formatter;

public class GenerateChecksum {

    public static void main(String[] args) {
        if (args.length != 2) {
            System.err.println("Usage: java GenerateChecksum <input file> <output file>");
            System.exit(1);
        }

        String inputFile = args[0];
        String outputFile = args[1];

        try {
            String checksum = calculateSHA256(inputFile);
            Files.write(Paths.get(outputFile), checksum.getBytes());
            System.out.println("Checksum written to " + outputFile);
        } catch (IOException | NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
    }

    private static String calculateSHA256(String filePath) throws IOException, NoSuchAlgorithmException {
        MessageDigest digest = MessageDigest.getInstance("SHA-256");
        try (FileInputStream fis = new FileInputStream(filePath)) {
            byte[] buffer = new byte[4096];
            int bytesCount;
            while ((bytesCount = fis.read(buffer)) != -1) {
                digest.update(buffer, 0, bytesCount);
            }
        }
        byte[] checksumBytes = digest.digest();
        return bytesToHex(checksumBytes);
    }

    private static String bytesToHex(byte[] bytes) {
        Formatter formatter = new Formatter();
        for (byte b : bytes) {
            formatter.format("%02x", b);
        }
        String result = formatter.toString();
        formatter.close();
        return result;
    }
}

Compile and Run the Java Program

  1. Compile the Java program:

    javac GenerateChecksum.java
  2. Run the Java program to generate the checksum:

    java GenerateChecksum spigot.jar spigot.jar.sha256

Explanation

  • Linux/macOS: Uses built-in commands like sha256sum or shasum -a 256 to generate the checksum and redirect it to a file.
  • Windows: Uses PowerShell's Get-FileHash cmdlet to generate the hash and format it.
  • Java: A Java program reads the file, calculates its SHA-256 checksum, and writes it to a specified output file.

Whichever method you choose, the contents of spigot.jar.sha256 should look something like this:

<checksum> spigot.jar

Here's an example of what the contents might look like:

e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  spigot.jar

This file can now be used with your checksum verification mechanism in your Kotlin application.

Step 2: Build and Run

After setup and translation, build and run the project using Maven or Gradle.

For Maven:

  1. Build the project:
    mvn clean package
  2. Run the application:
    java -jar target/spigot-loader-1.0-SNAPSHOT.jar

Ensure you replace "http://dev-spigot.com/dev-spigot.jar" and "http://dev-spigot.com/dev-spigot.jar.sha256" with the actual URLs pointing to your Spigot jar file and checksum file.

This Kotlin version should function similarly to the Java version but with the added benefits of Kotlin's concise syntax and features.

About

Download Spigot and inject into jvm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0