QT and Linking Other Libraries

I started QT and trying to write some small programs. In one program

, I wanted to send mail. Found a code how to send mail in C++ (uses winsock library, not QT’s) and integrated it to my program. But how, I gives some bunch of errors. They were linking errors.

... /mailer.cpp:17: undefined reference to `WSAStartup@8'

Then a little research helped to me: This link.

Open your project file (<projectname>.pro):

and add the line:


If your library is located in [QTDIR]\mingw\lib directory, you can just add the name of it (without its filename extension: .a):

LIBS += libwsock32

If you are developing in linux, the default library directory(or one of the library directories) might be /usr/lib.

SHA512 hashing on Java

Hello! For my school project, I had been tought of crypting passwords of users. Due to the fact that, SHA1 algorithm has security problems (link) , I have decided using a SHA2. SHA2 has 3 variants: SHA256, SHA384 and SHA512. While I was searching how to implement SHA2 on Java,  I have found this link.

For SHA512 that code works:

import java.security.*;

public class cryptotest {
    public static void main(String[] args) throws NoSuchAlgorithmException {
        MessageDigest md;
        String message = "password";
        try {
            md= MessageDigest.getInstance("SHA-512");

            byte[] mb = md.digest();
            String out = "";
            for (int i = 0; i < mb.length; i++) {
                byte temp = mb[i];
                String s = Integer.toHexString(new Byte(temp));
                while (s.length() < 2) {
                    s = "0" + s;
                s = s.substring(s.length() - 2);
                out += s;
            System.out.println("CRYPTO: " + out);

        } catch (NoSuchAlgorithmException e) {
            System.out.println("ERROR: " + e.getMessage());

If you want to hash password with SHA256

, you can change the line:

md= MessageDigest.getInstance("SHA-512");


md= MessageDigest.getInstance("SHA-256");

For others:

md= MessageDigest.getInstance("MD5");
md= MessageDigest.getInstance("SHA");
md= MessageDigest.getInstance("SHA-1");
md= MessageDigest.getInstance("SHA-384");