All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.yingzhuo.carnival.restful.security.params.ParamsValidatingAlgorithmImpl Maven / Gradle / Ivy

There is a newer version: 1.8.9
Show newest version
/*
 *  ____    _    ____  _   _ _____     ___    _
 * / ___|  / \  |  _ \| \ | |_ _\ \   / / \  | |
 * | |    / _ \ | |_) |  \| || | \ \ / / _ \ | |
 * | |___/ ___ \|  _ <| |\  || |  \ V / ___ \| |___
 * \____/_/   \_\_| \_\_| \_|___|  \_/_/   \_\_____|
 *
 * https://github.com/yingzhuo/carnival
 */
package com.github.yingzhuo.carnival.restful.security.params;

import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * @author 应卓
 * @since 1.6.30
 */
public class ParamsValidatingAlgorithmImpl implements ParamsValidatingAlgorithm {

    @Override
    public String encode(String parametersAsString) {
        return DigestUtils.sha256Hex(DigestUtils.md5Hex(parametersAsString));
    }

    @Override
    public boolean matches(String hashedParameters, String sign) {
        return StringUtils.equals(hashedParameters, sign);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy