captcha validation using hash5

captcha validation using hash5

I am using metadata plugin. I want to use validation where I have a hidden field that contains hash5 value of captcha text and I have to validate it with what user enters in captcha field, convert that value to hash5 and then compare with the hidden field. How can I do that? I have other fields in the form too and I want this to be added in the script.

<script type="text/javascript">
$().ready(function() {              
        var container = $('div.container');
    // validate the form when it is submitted
    var validator = $("#registrationform").validate({
        errorContainer: container,
        errorLabelContainer: $(container),
        //wrapper: 'li',
        meta: "validate"   
    });
 
    $(".cancel").click(function() {
        validator.resetForm();
    });
});
</script>